DEV Community

Faizan Arif
Faizan Arif

Posted on

20 1

How to stop docker containers from auto starting

Problem

As a developer, We work on different projects. Some of the projects (having oAuth or constant ports) work on only specific ports. For example, I've a project which always run on 8080. If any other process is using this port, I've to stop that process and then restart the project.
Most of the time, docker containers from other projects run
automatically on these ports after starting the system. So we've to manually shut them down.

Solution

  • We can stop specific container by going to the specific directory and then running the following command
docker-compose down // this will shut down all the containers running in that docker environment
Enter fullscreen mode Exit fullscreen mode

Additionally, to prevent a specific container from auto starting when a system is powered on (started), we can run following command

docker update --restart=no [container id] //without square brackets
Enter fullscreen mode Exit fullscreen mode

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (1)

Collapse
 
anodynos profile image
Angelos Pikoulas

Thanks, very useful! This should be in the Docker UI!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more