docker: mysql: docker-compose.yml setup
In this quick guide we show how to get a docker mysql running quickly that other docker containers can connect to.
If you need a quick mysql that stuff can connect to -create a new folder and inside it create a file named docker-compose.yml and put the following in it. If you need to install docker/docker-compose a quick script is here:
Note: version '2.0' is now obsoleted.
version: '2.1'
services:
mysql:
image: mysql:8.0
restart: always
ports:
- 3306:3306
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: 'somepassword'
To check that it ran properly:
docker-compose up
To run permanently in daemon mode:
docker-compose up -d