Differences between docker-compose run, up, build and create. Know each role.

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 -

** ▼ Classify commands by flow **
Image creation Container creation Container startup
build create start
run
up

▼ It looks like this when viewed with a command

docker-compose run/up = docker-compose build && docker-compose create && docker-compose start

Docker-compose runDocker-compose upDocker-compose buildDocker-compose createDocker-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

Differences between docker-compose run, up, build and create. Know each role.
Differences between IndexOutOfBoundsException and ArrayIndexOutOfBoundsException
Differences between "beginner" Java and Kotlin
Differences between Applet class and JApplet class
Differences between Java and .NET Framework
[Rails] I studied the difference between new method, save method, build method and create method.