Skip to content

Instantly share code, notes, and snippets.

@valdineireis
Created June 24, 2021 03:01
Show Gist options
  • Save valdineireis/62ca0a4dbbedc59b00ae59bfac098daa to your computer and use it in GitHub Desktop.
Save valdineireis/62ca0a4dbbedc59b00ae59bfac098daa to your computer and use it in GitHub Desktop.
Utilizando o Docker para subir o MySQL

Download da imagem

docker image pull mysql:5.7

Rodar o mysql apontando para um volume externo

docker run --name meu-bd -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -v C:\Users\usuario\pasta\mysql:/var/lib/mysql mysql:5.7

Listar os containers

docker container ls

Inspecionar para pegar o IP

docker container inspect <CONTAINER_ID>

Acessar o container para executar comandos

docker exec -it <CONTAINER_ID> bash

Remover o container

docker container rm <CONTAINER_ID> --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment