Skip to content

trandung2k1/docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn Docker

  1. Pull sql server image
docker pull mcr.microsoft.com/mssql/server:2019-latest
  1. 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
  1. Stop container
docker start sql-server-2019
  1. Start container
docker start sql-server-2019
  1. 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
  1. Pull mysql
docker pull mysql
  1. Run container
docker run --name mysql-container -e MYSQL_ROOT_PASSWORD=Abc@123456789 -p 3307:3306 -v mysql-volume:/var/lib/mysql -d mysql
  1. 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
  1. Remove all container
docker rm $(docker ps -a -q)
  1. Delete all volumes
docker volume rm $(docker volume ls -q)
  1. Dig(DNS lookup utility)
dig todo-app-network-alias
  1. Create network
docker network create demo
  1. Show all networks
docker network ls
  1. Remove network
docker network rm network_name