There are many similar docker-compose commands such as run, up, build, create. Prevent confusion by understanding each role.
| command | Target | Remarks |
|---|---|---|
| run | Image & container creation | Specify one service. up starts all services (containers) at once |
| up | Image & container creation & launch | Start all containers at once. Do until startup |
| build | Creating an image | - |
| create | Creating a container | - |
| up | Start container | - |
| Image creation | Container creation | Container startup |
|---|---|---|
| build | create | start |
| run | → | |
| up | → | → |
docker-compose run/up = docker-compose build && docker-compose create && docker-compose start
・ Docker-compose run ・ Docker-compose up ・ Docker-compose build ・ Docker-compose create ・ Docker-compose start
Basically the command to use should be docker up.
When running or up, if the image already exists, it will not be recreated, so if there is a change in dockerfile or docker-compose.yml, rebuild the image.
Recommended Posts