docker commands

docker system prune
#remove `在這裏插入代碼片`all stopped containers, all dangling images and all unused networks
#From <https://linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks/> 
#Install apps in docker container
apt-get update
#execute at first to get resources
docker commit $(new container ID) $(image id)
#docker commit the changes of docker
#https://blog.csdn.net/baidu_19473529/article/details/69857313
docker inspect <container id>
#get configs about container
docker run -t -I <container id> /bin/bash
#docker run: runs a container.
#ubuntu: is the image you would like to run.
#-t: flag assigns a pseudo-tty or terminal inside the new container.
#-i: flag allows you to make an interactive connection by #grabbing the standard in (STDIN) of the container.
#/bin/bash: launches a Bash shell inside our container.
docker rmi -f  $(docker images --filter “dangling=true” -q --no-trunc)
#delete all <None> images
#From <https://forums.docker.com/t/how-to-remove-none-images-after-building/7050/5> 
docker ps
#list all containers
docker container prune -f 
#remove all stopped containersdoc

Dockerfile 分爲四部分:基礎鏡像信息、維護者信息、鏡像操作指令和容器啓動時執行指令。’#’ 爲 Dockerfile 中的註釋

docker exec -it <mycontainer> bash
#enter the terminal of a running container

#From <https://cloud.tencent.com/developer/article/1004349> 

docker run -d --name xreg_server_more_pointer -P -v $(pwd):/app xreg_server_more_pointer
# assign a random IP to docker container 
docker rmi --force $(docker images -q imagename | uniq)
#From <https://stackoverflow.com/questions/40084044/how-to-remove-docker-images-based-on-name> 
發佈了14 篇原創文章 · 獲贊 0 · 訪問量 2372
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章