dependency failed to start: container 248-opensearch-1 is unhealthy
Operating System: Ubuntu 24 Magento: 2.4.8 Installation Execution: Manual Magento installation Using Docker
How to resolve this error can anyone guide me?
The "container 248-opensearch-1 is unhealthy" error is a known issue in the docker-magento setup. Here are the most effective steps to resolve it:
-
Check Java Options for CPU Architecture
If you are using an Intel or AMD processor (not Apple Silicon/ARM), open yourenv/opensearch.envfile and remove or comment out the line:_JAVA_OPTIONS: -XX:UseSVE=0This option is only needed for ARM64/Apple Silicon chips and can cause OpenSearch to fail on Intel/AMD systems
Reference. -
Update the Healthcheck Configuration
The default healthcheck may not give OpenSearch enough time to start. In yourcompose.healthcheck.yaml, update the OpenSearch healthcheck to:opensearch: healthcheck: test: "curl --fail opensearch:9200/_cat/health >/dev/null || exit 1" interval: 5s timeout: 5s retries: 30This increases the number of retries and allows more time for OpenSearch to become healthy
Reference. -
Ensure Sufficient System Resources
Make sure your system has at least 8GB RAM available and is not overcommitted with other containers or processes
Reference. -
Check OpenSearch Container Logs
If the above steps do not resolve the issue, check the logs for the OpenSearch container for more specific errors:docker logs <container_id> -
Switch to Elasticsearch (Optional)
If you continue to have issues, you can switch from OpenSearch to Elasticsearch by replacing the OpenSearch section in yourcompose.yamlwith:elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 container_name: magento-elasticsearch environment: - discovery.type=single-node - xpack.security.enabled=false - bootstrap.memory_lock=true ulimits: memlock: soft: -1 hard: -1 mem_limit: 2g ports: - "9200:9200"
These steps are based on recent discussions and fixes in the docker-magento project and should resolve the unhealthy OpenSearch container issue in most cases.
To continue talking to Dosu, mention @dosu-bot.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
still not working for me in ubuntu 24
I have the same issue. @markshust Please try to correct it, I miss my local magento instance
@markshust Please Help me to resolve this problem in ubuntu 24. its failed every time. unable to install magento 247 and 248 version using your docker repository.
All the above methods have been tested, but still failed.
I’m facing the same issue where docker-opensearch-1 becomes unhealthy and causes the stack to fail, using the Automated Setup (New Project) method.
OS: Ubuntu 24.04
Steps to reproduce:
-
Followed the one-line setup script.
-
Docker services started, but OpenSearch is marked as unhealthy.
-
Error: dependency failed to start: container docker-opensearch-1 is unhealthy
Here’s a screenshot of what I’m seeing:
Would appreciate any insights or fixes.
I believe we should increase the interval/timeout/retries number inside the compose.healthcheck.yaml. Maybe just increse the retries to 30? I tried to make a PR but somehow it always fail (error 403)
Just like all the provided screenshots above, I use the "automated one-liner set up", and the docker compose build is failing on the opensearch service. Because of that, the whole processes is stopped. However, after that, if I run the docker compose up -d manually, all the service is up and running successfully.
So yeah, I believe this is simply caused by the low number of interval/timeout/retries we currently have.
What do you think @markshust ?
Update :
While using the "automated one-liner set up" ends up in a failed docker build by the opensearch service, the following works:
- Following the manual set up, download the docker compose template:
curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash - From your IDE, open the compose.healthcheck.yaml file, and change the
x-healthcheck-defaults>retriesvalue to 30. - Continue the manual set up steps, run
bin/download community 2.4.8, etc.
Facing this error while executing magento upgrade command
Thanks Now its working after execute bin/setup magento.test.
Thanks for the solution @mrifqyabdallah
Hey all,
Just want to share my solution on this issue. I kept on getting issues with opensearch and elasticsearch on my newest mac mini. After some digging around I tried a few other the solutions that have been shared. Changing the retries, switching to elasticsearch, I even tried having AI help me out but nothing seem to work. Here is what I found out, there seem to be issues with the new apple M-chips and opensearch/elasticsearch not really sure what but they just do not seem to play well together, at least in docker land.
The one thing that worked for me, was to downgrade the version of opensearch in the composer.yaml file. I changed it to image: markoshust/magento-opensearch:2.5-1 then continued with the manual setup. To help in this process if you were like me and fighting with the install a few different times. Once you change that it would be best to just follow these steps and things should work link normal.
- Run
bin/removeallto start fresh - Run
bin/download community 2.4.8# or whatever you are trying to download - Run
bin/setup magento.test
That is it, then the scripts seem to have started working as expected and Magento is up and running.
I hope this helps someone else in the future.
Lastly, I am not even really sure where to start but the automated run script just won't work for those folks on the M-series chips. Heck, i am just getting back into magento, i am wouldn't even really consider this a "solution" but it worked for me.
Hey all! It's great that you came across a proposed fix, and that there was a PR for it.
Note that I did make a little change to it, as documented at https://github.com/markshust/docker-magento/pull/1352#issuecomment-3024015766. If this fix doesn't work, please let me know and I will reopen this ticket. However, I'm under the assumption that 52.0.2 will resolve your issue, so you can run bin/update to get the updates (remember to VCS or backup your changes locally first, if you have any).