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.