yml(yaml)은 버전별로 양식이 다르니 유의하세요.
0. docker-compose.yml
version: '2'
services:
api:
ports:
- "5000:80"
- "5001:443"
build:
context: .
dockerfile: Dockerfile
# volumes:
# - ./:/var/www
depends_on:
- db
- cache
db:
image: mariadb
environment:
- "MYSQL_USER={{userid}}"
- "MYSQL_PASSWORD={{password}}"
- "MYSQL_ROOT_PASSWORD={{root_password}}"
- "MYSQL_DATABASE={{default_database}}"
ports:
- "3306:3306"
cache:
image: redis:5.0
ports:
- "6379:6379"
2. mysql
sudo docker exec -it test_db_1 sh
#mysql -h127.0.0.1 -uroot -p
3. redis
sudo docker exec -it test_cache_1 sh
#redis-cli
'docker' 카테고리의 다른 글
Raw-mode is unavailable courtesy of Hyper-V. (VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT). (0) | 2019.06.26 |
---|---|
Docker 와 Docker-compose 설치 (0) | 2019.06.26 |