Essential Docker Compose Commands

Launch in background

docker-compose up -d

If you want to rebuild docker images you can use –build flag after up command. This is essentially same as you would write:

# docker build .
# docker run myimage

docker-compose up –build

Stop containers

docker-compose down

List running images on containers

docker-compose ps

Tagging docker images

Normally with “docker build . ” you get docker id that you can run with “docker run DOCKERID” but if you want a bit more friendly name you can tag it like this:

docker build -t YOURDOCKERUSERNAME/PROJECT:latest .

After that you can refer to the image with the tag instead of id like this

docker run -p 8081:8081 YOURDOCKERUSERNAME/PROJECT