DEV Community

Cover image for Docker + MariaDB
Thiago Silva
Thiago Silva

Posted on

Docker + MariaDB

Database popular among developers.

Get container pull.

docker pull "mariadb"
Enter fullscreen mode Exit fullscreen mode

Create network for data.

docker network create "mariadb"
Enter fullscreen mode Exit fullscreen mode

Create volume for data.

docker volume create "mariadb"
ln -s "/var/lib/docker/volumes/mariadb" "/data/volume/"
Enter fullscreen mode Exit fullscreen mode

Create and run container.

docker run --name "mariadb" \
    -p 3306:3306 \
    --network "mariadb" \
    -v "mariadb":"/var/lib/mariadb" \
    -e MARIADB_ROOT_PASSWORD="master" \
    --restart=always \
    -d "mariadb":"latest"
Enter fullscreen mode Exit fullscreen mode

Database access "MARIADB_ROOT_PASSWORD".

Start container.

docker start "mariadb"
Enter fullscreen mode Exit fullscreen mode

Access container.

docker exec -it "mariadb" "/bin/bash"
Enter fullscreen mode Exit fullscreen mode

https://github.com/thiagoeti/docker-mariadb

Top comments (0)