終于開始了新的工作,感覺非常不錯。今天公司居然停電可以早點下班了,記錄一下 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_namedocker exec -it container_name /bin/bashjupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root