> wget -qO- https://get.docker.com/ | sh > sudo usermod -aG docker danliwoo > service docker start > # restart the shell!!! > docker run hello-world
Hello from Docker! This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/
For more examples and ideas, visit: https://docs.docker.com/get-started/
> docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3ed73013d8ce danliwoo/gpmed:part3 "/bin/bash" About an hour ago Exited (0) 6 seconds ago frosty_shaw 2e1af5e8495b danliwoo/gpmed:part3 "/bin/bash" 4 weeks ago Up 2 days 22/tcp, 80/tcp, 0.0.0.0:2333->8888/tcp peaceful_keller > docker rm 3e 3e 这里只需要敲容器 ID 的前两位,就可以删除指定容器(除非不唯一,则会提醒)。
容器很多,一个一个删也太费事了
1 2 3 4 5 6 7 8 9 10 11 12
> docker container prune WARNING! This will remove all stopped containers. Are you sure you want to continue? [y/N] y Deleted Containers: 61e0c59a43b75a76f04ca90905b6e9b02caf67d13333c9a0f0e487a6077810b5 b7212cb2065a3cb2816f9efe07a0bc8203a1e44c916cb4385ae477c9f8d8d127 21d69920d8c9b02b34e51c0e01347f0d411046668e5d2698218df857a3ce14f0 0d4c407b221ef99e7b623186593255744aa157f2db1e51975b0d647497c62960 49a9fe9a9cf45fa2983cf51ed41497c5b14a1052f76fab3de0441f4a57660159
Total reclaimed space: 1.306kB
挂载系统文件到容器中
1 2
> docker run -v [本地目录]:[容器目录] [镜像] > docker run -it -p 17813:8888 -p 6006:6006 -v ~/tensorflow-tutorial:/app danliwoo/gpmed:part3