docker-compose command
docker-compose command
It is not a production-grade tool but ideal for local development and test.
Most common command
$ docker-compose up
- Setup volumes/networks and start all containers according to docker-compose.yml file
$ docker-compose down
- Stop all containers and remove containers, volumes, and networks
docker-compose.yml file looks like:
Using Compose to Build
- Compose will bulid images with
docker-compose up
if image not found in cache - Can rebuild with
docker-compose build
command
$ docker-compose build
docker-compose can use $ docker secret
- No! It just works as though there is docker swarm database and use its secret database.
- docker-compose는 production용이 아니라는 사실을 기억하자! develop 용일뿐!
- docker-compose가 이런 기능을 제공함으로써 우리는 개발 중에도 production 모드의 스크립트를 그대로 사용할 수 있다는 이점을 가져갈 수 있다!
docker-compose.yml override
- docker-compose.yml의 override 속성을 통해서 docker-compose.yml 파일을 여러개로 나누어서 사용할 수 있다.
- parents: docker-compose.yml
- child: docker-compose.override.yml
- parents: docker-compose.yml
$ docker-compose up
만으로도 자동으로docker-compose.override.yml
파일을 읽어들인다.