- Pull sql server image
docker pull mcr.microsoft.com/mssql/server:2019-latest
- Run container from image sql server account: sa(Abc@123456789)
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Abc@123456789" --name sql-server-2019 -p 1435:1433 -d mcr.microsoft.com/mssql/server:2019-latest
- Stop container
docker start sql-server-2019
- Start container
docker start sql-server-2019
- Save data to volume
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Abc@123456789" --name sql-server-2019 -v my-volum-1:/var/opt/mssql -p 1435:1433 -d mcr.microsoft.com/mssql/server:2019-latest
- Pull mysql
docker pull mysql
- Run container
docker run --name mysql-container -e MYSQL_ROOT_PASSWORD=Abc@123456789 -p 3307:3306 -v mysql-volume:/var/lib/mysql -d mysql
- Login mysql container use bash
docker exec -it mysql-container sh
mysql -u root -p
mysql --protocol=tcp -h localhost -P 3307 -u root -p
- Remove all container
docker rm $(docker ps -a -q)
- Delete all volumes
docker volume rm $(docker volume ls -q)
- Dig(DNS lookup utility)
dig todo-app-network-alias
- Create network
docker network create demo
- Show all networks
docker network ls
- Remove network
docker network rm network_name