docker-compose up -d
docker-compose down
docker-compose logs -f {service_name}
레드마인을 MySQL을 사용해 생성하기
version: '3.1'
services:
redmine:
image: redmine
restart: always
container_name: emc_redmine
ports:
- 3000:3000
environment:
REDMINE_DB_MYSQL: db
REDMINE_DB_PASSWORD: 9999
REDMINE_DB_ENCODING: utf8
db:
image: mysql:5.7
restart: always
container_name: emc_redmine_db
ports:
- 13306:3306
environment:
MYSQL_ROOT_PASSWORD: 9999
MYSQL_DATABASE: redmine
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
docker volume ls --> 확인
볼륨을 자동으로 생성하는 방법으로 생성 (명시적 볼륨이 아니라 docker자체에서 자동생성)
단, 이 기능은 version 3 이상에서 사용가능
version: '3.7'
services:
redmine:
container_name: redmine
image: redmine
restart: always
depends_on:
- emc_db
ports:
- 3000:3000
environment:
REDMINE_DB_MYSQL: emc_db
REDMINE_DB_PASSWORD: 9999
emc_db:
image: mariadb
container_name: emc_db
restart: always
environment:
MYSQL_ROOT_PASSWORD: 9999
MYSQL_DATABASE: redmine
volumes:
- "con_db:/var/lib/mysql"
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
volumes:
con_db:
명시적으로 볼륨컨테이너를 생성한다.
이 경우 docker-compose down 으로 삭제할 경우 해당 볼륨컨테이너가 삭제되므로 별도로 컨테이너 데이터를 저장하지 않을경우, 이후 데이터가 날라간다.
version: '3.7'
services:
redmine:
container_name: emc_redmine
image: redmine
restart: always
depends_on:
- emc_db
ports:
- 3000:3000
environment:
REDMINE_DB_MYSQL: emc_db
REDMINE_DB_PASSWORD: 9999
emc_db:
image: mariadb
container_name: emc_db
restart: always
environment:
MYSQL_ROOT_PASSWORD: 9999
MYSQL_DATABASE: redmine
volumes:
- emc_con
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
emc_con:
image: busybox
container_name: emc_con
volumes:
- /var/lib/mysql