1version: "3.3"
2services:
3 db:
4 image: mysql:lts
5 restart: always
6 environment:
7 MYSQL_DATABASE: "db"
8 # So you don't have to use root, but you can if you like
9 MYSQL_USER: "user"
10 # You can use whatever password you like
11 MYSQL_PASSWORD: "password"
12 # Password for root access
13 MYSQL_ROOT_PASSWORD: "password"
14 ports:
15 # <Port exposed> : <MySQL Port running inside container>
16 - "3306:3306"
17 expose:
18 # Opens port 3306 on the container
19 - "3306"
20 # Where our data will be persisted
21 volumes:
22 - my-db:/var/lib/mysql
23# Names our volume
24volumes:
25 my-db: