okecity.com

setup docker mariadb to remote connection

setup docker mariadb to remote connection

we asoum we have install docker before:

pull image mariadb:

docker pull mariadb:latest

output:

 latest: Pulling from library/mariadb
b84950154c18: Pull complete
b1ae07faadba: Pull complete
46428e702eff: Pull complete
0e775e0ed5a0: Pull complete
031c54d0d9d9: Pull complete
602265dc68e1: Pull complete
3d1d131fb6cb: Pull complete
3a33ea1b3043: Pull complete
9539c6148f07: Pull complete
38aa29868643: Pull complete
3702214dffba: Pull complete
Digest: sha256:88fcb7d92c7f61cd885c4d309c98461f3607aa6dbd57a2474be86e1956b36d13
Status: Downloaded newer image for mariadb:latest
docker.io/library/mariadb:latest

set container and run mariadb

docker container run \
        --name sql-maria \
        -e MYSQL_ROOT_PASSWORD=12345root \
        -e MYSQL_USER=username \
        -e MYSQL_PASSWORD=12345passwd \
        -e MYSQL_DATABASE=dbname \
        -p 3306:3306 \
        -d mariadb:latest
 

done, try to connect from other computer.

Watch the logs and wait for mariadb server is up

 docker container logs -f sql-maria

connect from local docker mariadb

docker exec -it sql-maria bash

Done 

Category: Tekno

Share: