docker-magento icon indicating copy to clipboard operation
docker-magento copied to clipboard

dependency failed to start: container 248-opensearch-1 is unhealthy

Open bhushanmeetanshi opened this issue 7 months ago • 10 comments

Image

Operating System: Ubuntu 24 Magento: 2.4.8 Installation Execution: Manual Magento installation Using Docker

How to resolve this error can anyone guide me?

bhushanmeetanshi avatar May 26 '25 12:05 bhushanmeetanshi

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:

  1. Check Java Options for CPU Architecture
    If you are using an Intel or AMD processor (not Apple Silicon/ARM), open your env/opensearch.env file and remove or comment out the line:

    _JAVA_OPTIONS: -XX:UseSVE=0
    

    This option is only needed for ARM64/Apple Silicon chips and can cause OpenSearch to fail on Intel/AMD systems
    Reference.

  2. Update the Healthcheck Configuration
    The default healthcheck may not give OpenSearch enough time to start. In your compose.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: 30
    

    This increases the number of retries and allows more time for OpenSearch to become healthy
    Reference.

  3. Ensure Sufficient System Resources
    Make sure your system has at least 8GB RAM available and is not overcommitted with other containers or processes
    Reference.

  4. 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>
    
  5. Switch to Elasticsearch (Optional)
    If you continue to have issues, you can switch from OpenSearch to Elasticsearch by replacing the OpenSearch section in your compose.yaml with:

    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"
    

    Reference

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

dosubot[bot] avatar May 26 '25 12:05 dosubot[bot]

Image

still not working for me in ubuntu 24

bhushanmeetanshi avatar May 30 '25 11:05 bhushanmeetanshi

I have the same issue. @markshust Please try to correct it, I miss my local magento instance

Serwach avatar Jun 01 '25 01:06 Serwach

@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.

bhushanmeetanshi avatar Jun 12 '25 04:06 bhushanmeetanshi

All the above methods have been tested, but still failed.

JoeWest9966 avatar Jun 15 '25 00:06 JoeWest9966

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:

Image

Would appreciate any insights or fixes.

GeovaneF55 avatar Jun 16 '25 14:06 GeovaneF55

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 > retries value to 30.
  • Continue the manual set up steps, run bin/download community 2.4.8, etc.

mrifqyabdallah avatar Jun 19 '25 04:06 mrifqyabdallah

Image

Facing this error while executing magento upgrade command

bhushanmeetanshi avatar Jun 20 '25 07:06 bhushanmeetanshi

Thanks Now its working after execute bin/setup magento.test.

bhushanmeetanshi avatar Jun 20 '25 10:06 bhushanmeetanshi

Thanks for the solution @mrifqyabdallah

bhushanmeetanshi avatar Jun 20 '25 10:06 bhushanmeetanshi

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.

  1. Run bin/removeall to start fresh
  2. Run bin/download community 2.4.8 # or whatever you are trying to download
  3. 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.

roman-bytes avatar Jun 23 '25 01:06 roman-bytes

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).

markshust avatar Jul 01 '25 13:07 markshust