Docker 基本操作

終于開始了新的工作,感覺非常不錯。今天公司居然停電可以早點下班了,記錄一下 Docker 的一些基本操作,上下班路上方便用手機復習。網(wǎng)上找到了這個非常好的教程 Docker Curriculum ,比官網(wǎng)更加簡潔。

Useful commands:

  • docker build: build an image defined by Dockerfile
  • docker images: list all locally available images
  • docker rmi image_name: remove image
  • docker run:
    • docker run -c 1024 -it -w /working_directory_within_container/ -p 8888:8888 -v /full_host_dir/: /container_dir/ image_name /bin/bash: create a container from an image and run interactively with bash, with 8888 later for jupyter notebook, with full CPU usage
    • docker run --rm image_name: create a container from an image and then delete it, the image can be downloaded if not available
  • docker load -i: load an image from tar file
  • docker pull: download images
  • docker ps -a: all runed containers
  • docker container stop container_name: stop a running container
  • docker rm container_name: remove a container
  • docker rm $(docker ps -a -q -f status=exited) == docker container prune
  • Run an existed container
    • docker container start container_name
    • docker exec -it container_name /bin/bash
    • jupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root

參考閱讀

  1. Docker Curriculum

  2. Docker IO

最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容