0x0003 - mysql docker-compose example

mysql docker-compose example

0x0003 - mysql docker-compose example

Before you activate the docker-compose, you will need to permanently add the proxy network.

docker network create proxy

The most basic installation recipe.


version: '3'

services:
  mysql:
    image: mysql:latest
    container_name: mysql
    #command: mysqld
    volumes:
      - ./dbdata:/var/lib/mysql:z
    ports:
      - 3306:3306
    environment:
      - MYSQL_ROOT_PASSWORD=your_password
    restart: always
    networks:
      - proxy

networks:
  proxy:
    external: true

After that it is simply a matter of compiling the docker-compose.yml file

If you do not specify the -d option you can run this in diagnostic mode.

docker compose up 
docker-compose up -d

Will give you the truncated logging - but now  it will permanently as a daemon

Connecting to your mysql docker will require specifying the host now, and before you can call mysql you will need to install it.

sudo apt install mysql-client-core-8.0*
mysql -h localhost -u root -p
Linux Rocks Every Day