DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Faizan Arif
Faizan Arif

Posted on

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

Top comments (0)

πŸŒ–πŸŒ—πŸŒ˜ Turn on dark mode in Settings