docker-compose.yml
Example Docker Compose
version: "3"
services:
app: # SERVICE name
container_name: test-app
restart: always
build:
context: ./app
args:
- TEST_ARG # Build argument
ports:
- "8000:8000"
expose:
- "8000"
depends_on:
- db
volumes:
- "./app:/app"
db: # SERVICE name
container_name: ml-db
image: mysql:5.6
volumes:
- "dbdata:/var/lib/mysql"
environment:
- "MYSQL_USER=user"
- "MYSQL_PASSWORD=password"
- "MYSQL_ROOT_PASSWORD=password"
- "MYSQL_DATABASE=db"
ports:
- "33061:3306"
expose:
- "3306"
volumes:
dbdata:Setting up database in Docker
Environment in yaml file:
Running a project that uses Docker Compose
Running a project that uses Docker Compose build arguments
Seeding a database with a SQL file in Docker Compose
Running a command without a Docker container being up
Last updated