Skip to content

Instantly share code, notes, and snippets.

@lostsnow
Last active April 3, 2020 02:55
Show Gist options
  • Save lostsnow/54ec2b61c60549f32a8d9815032fbaf8 to your computer and use it in GitHub Desktop.
Save lostsnow/54ec2b61c60549f32a8d9815032fbaf8 to your computer and use it in GitHub Desktop.
docker compose for mysql 5.7
version: '3.3'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: 'planet'
# So you don't have to use root, but you can if you like
MYSQL_USER: 'user'
# You can use whatever password you like
MYSQL_PASSWORD: '123456'
# Password for root access
MYSQL_ROOT_PASSWORD: '123456'
ports:
# <Port exposed> : < MySQL Port running inside container>
- '33057:3306'
expose:
# Opens port 3306 on the container
- '3306'
# Where our data will be persisted
volumes:
- db-mysql57:/var/lib/mysql
# Names our volume
volumes:
db-mysql57:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment