Windows Docker 桌面
- 系统要求:win10 64位专业版或企业版。
- 早期版本请使用 Docker Toolbox。
- Docker Desktop for Windows 下载地址。
版本说明
- Stable:稳定版,每个季度发布一次。
- Edge:测试版,每月发布一次。
安装运行
双击 Docker for Windows Installer.exe 即可安装 Docker 程序。
安装完成后,Docker会自动启动。 任务栏中出现鲸鱼图标表示 Docker 正在运行,可以从终端访问并使用 Docker。
打开 PowerShell 终端(非 PowerShell ISE),查看 Docker 版本:
docker version
测试拉取镜像和运行镜像:
docker run hello-world
...
Hello from Docker!
...
右击鲸鱼图标可以打开 Docker 面板和设置等功能。
常用命令
查看已下载的镜像:
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 15 months ago 1.84kB
查看所有容器:
docker container ls --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3189274c0687 hello-world "/hello" 34 minutes ago Exited (0) 34 minutes ago angry_liskov
查看系统信息:
docker info
使用帮助命令:
docker --help
docker container --help
docker container ls --help
docker run --help
docker <command> --help
使用 Docker 运行 Ubuntu
拉取 Ubuntu OS 映像,并使用交互式终端进入容器:
> docker run --interactive --tty ubuntu:latest bash
- --interactive:打开 STDIN 与容器进行交互操作。
- --tty:使用伪终端。
进入容器后,在 root 提示符 #
后输入:
root@8aea0acb7423:/# hostname
8aea0acb7423
root@8aea0acb7423:/# exit
>
显示容器ID即为 Ubuntu OS 的主机名。
查看所有容器:
docker container ls --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c67569f7e997 ubuntu "bash" 4 minutes ago Exited (0) About a minute ago blissful_nobel
3189274c0687 hello-world "/hello" 49 minutes ago Exited (0) 49 minutes ago angry_liskov
hello-world 和 ubuntu 容器均为随机命名。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。