Bobcares

Docker Error Container is Unhealthy: Troubleshooting

by | Oct 5, 2022

Let us examine the error docker error container is unhealthy and the various causes and the troubleshooting steps for it with the support of our Docker Hosting Support Services at Bobcares.

ERROR: Container is unhealthy

docker error container is unhealthy

To deal with the Error Container is unhealthy error follow some of the most basic troubleshooting tips given below:

  • Docker-compose stop should be executed via Powershell.
  • Powershell should be used to run docker-compose down.
  • To confirm that the right ports are available, use Powershell to run iisreset /stop.
  • Type docker-compose up -d in Powershell now.

1: Causes and Troubleshooting steps for the ERROR: Container is unhealthy

  • Having VPN enabled when starting up Docker can also cause problems. Although it is unclear why the VPN is creating the problem, try disabling it and rechecking.
  • Changing the SQL SA PASSWORD in the.env file might help. It is necessary to run clean. ps1 to remove any previously created database files. After that, we can try again. We’ll use ps1 if we’re utilizing the Getting Started template.
  • Examining logs is the most effective method for determining what is causing the problem.

    Open Visual Studio -> View -> Other Windows –> Containers. Examining logs is the most effective method for determining what is causing the problem.

  • The error could be caused by an erroneous path to the license file in the “docker-compose.override.yml” file. It worked once I corrected the path.
  • The genuine solution is to investigate why the health check is failing. Most of this is straightforward. Open Powershell on the laptop and type “docker container ls.” Locate the container as having an unhealthy state.

    Open Docker Desktop and pick the sick container. It is important to note that an unhealthy container may not appear unwell on Docker desktop, which is why the prior “ls” command is so important.

2

  • Examine the logs. It will almost certainly run the health check on a regular basis and register the attempt. An example of a failed CM health check is as follows:

    GET /healthz/ready - 80 - ::1 Mozilla/5.0+(Windows+NT;+Windows+NT+10.0;+en-US)+WindowsPowerShell/5.1.17763.2268 - 500 0 0 35126

    The health check is attempting to access /healthz/ready and receiving a 500 status code. This indicates that our application is experiencing a YSOD, but we are unable to view it in the Sitecore logs (because Sitecore cannot even start).

    To view the raw output, run the following command in the shell:

    curl http://127.0.0.1/healthz/ready All container types can benefit from a similar strategy. Each container may have a slightly different health check, but this method gets to the bottom of the issue.

    We must ensure that Docker is executing in Windows containers if the docker error container is unhealthy error appears.

    To test this, right-click on the Docker icon in the system tray and see if the ‘Switch to Linux containers’ option appears. If so, Docker for Windows containers is already running.

  • We have to ensure that the option ‘Use Docker Compose V2’ is unchecked.
  • Run the following commands and see if that works:

    docker-compose stop
    docker-compose down
    iisreset /stop
    docker-compose up -d

3

  • 404 page not found error: This could be the case if we notice this issue while exploring the CM/CD site.

    To browse the site from within the containers, we must connect to them using either Visual Studio or Visual Studio Code and run the following command.

    This will display the real error on the site, which can then be rectified.

    curl http://localhost/

  • The error is caused by the fact that docker-compose is running on the v2 version. Run this command to verify this. If it’s operating in v2, uncheck the ‘Use Docker Compose V2’ checkbox in Docker -> settings.

    Sometimes it shows v2 even though the ‘Use Docker Compose V2’ checkbox is ticked. In that situation, use the following command to disable the V2.

    docker-compose disable-v2

  • mem limit error: This problem occurs as a result of the docker running on V2. As a result, ensure that it is not operating on v2.
  • For xxxxxx ERROR Service cannot be started. hcsshim: xxxxxx CreateComputeSystem xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx The requested resource is currently in use:

    When attempting to bring up the containers, we may encounter this issue. The fix is to restart the “Hyper-V Host Compute Service” service and try again.

  • Stop IIS and also disconnect from any VPN service if connected. The docker might not work if the VPN is active.

[Need assistance with similar queries? We are here to help]

Conclusion

To conclude we have learned more about the error: docker error container is unhealthy and the various causes and the troubleshooting steps associated with it with the support of Docker Hosting support services.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF