Disabling automatic boot on certain docker container in docker-compose file

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Muzzy,

Thank you for reaching out with your question about managing Docker containers on your Toradex system. To achieve your goal of having certain containers start automatically while others remain manual, you can configure your Docker Compose file effectively. Here’s how you can set this up on Torizon OS:

  1. Docker Compose File Location: Make sure your docker-compose.yml file is located in the /var/sota/storage/docker-compose/ directory on your Torizon system. This is the directory Torizon OS uses to identify containers that should start at boot.

  2. Configuring Automatic Start: For the containers you want to start automatically, use the restart policy in your docker-compose.yml file. Set it to always or unless-stopped for these containers. This ensures they start at boot and restart if they fail.

    Example:

    services:
      core_service_1:
        image: your-core-image-1
        restart: always
      core_service_2:
        image: your-core-image-2
        restart: always
      core_service_3:
        image: your-core-image-3
        restart: always
    
  3. Preventing Automatic Start: For containers you want to start manually, omit the restart policy or set it to no. This will prevent them from starting automatically at boot.

    Example:

    services:
      manual_service_1:
        image: your-manual-image-1
        restart: no
      manual_service_2:
        image: your-manual-image-2
        restart: no
    
  4. Manual Start: To start these containers manually, use the Docker Compose command:

    docker-compose -f /var/sota/storage/docker-compose/docker-compose.yml up manual_service_1
    

    Replace manual_service_1 with the name of the service you wish to start.

By configuring your docker-compose.yml file in this way, you can control which containers start automatically and which require manual intervention. This setup allows you to maintain flexibility in managing your containerized applications on Torizon OS.

I hope this helps! If you have any more questions, feel free to ask.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

Run application on boot.