1.docker 命令
docker start nginx
https://www.w3cschool.cn/docker/windows-docker-install.html
// docker ps : 列出容器
C:UsersAdministrator>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7bcdd684fed4 apple:v1.0.0 "/bin/bash" 22 minutes ago Exited (130) 6 minutes ago AppleLinux
7dc76ffa43d5 e0ab582c12aa "--name=apple" 24 minutes ago Created 0.0.0.0:2000->22/tcp, 0.0.0.0:8080->80/tcp, 0.0.0.0:3000->3306/tcp hopeful_swirles
00a4226fd711 hello-world "/hello" 34 minutes ago Exited (0) 34 minutes ago flamboyant_noether
//启动 镜像
C:UsersAdministrator> docker start 2f977d571a19
2f977d571a19
//显示 docker COMMAND
C:UsersAdministrator>docker
C:UsersAdministrator>docker search httpd
//导入镜像
C:UsersAdministrator>docker import G:apple.tar
sha256:e0ab582c12aa0c80cee1a7b0fec7735cd1f1464662dd0f70da18870fe125a79b
//docker images : 列出本地镜像。
C:UsersAdministrator>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
apple v1.0.0 e0ab582c12aa 13 minutes ago 1.65GB
hello-world latest f2a91732366c 6 days ago 1.85kB
//修改镜像名
C:UsersAdministrator>docker tag e0ab582c12aa apple:v1.0.0
//查看镜像
C:UsersAdministrator>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
apple v1.0.0 e0ab582c12aa 18 minutes ago 1.65GB
hello-world latest f2a91732366c 6 days ago 1.85kB
//创建一个新的容器并运行一个命令
C:UsersAdministrator>docker run --name AppleLinux -i -d -t -p 8080:80 -p 3000:3306 -p 2000:22 apple:v1.0.0 /bin/bash
7bcdd684fed44f2b98eeda346490e8437c92234dd3435f3f84ecaf984053e303
// 列出所有容器
C:UsersAdministrator>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7bcdd684fed4 apple:v1.0.0 "/bin/bash" 45 seconds ago Up 44 seconds 0.0.0.0:2000->22/tcp, 0.0.0.0:8080->80/tcp, 0.0.0.0:3000->3306/tcp AppleLinux
7dc76ffa43d5 e0ab582c12aa "--name=apple" 2 minutes ago Created 0.0.0.0:2000->22/tcp, 0.0.0.0:8080->80/tcp, 0.0.0.0:3000->3306/tcp hopeful_swirles
00a4226fd711 hello-world "/hello" 12 minutes ago Exited (0) 12 minutes ago flamboyant_noether
jolly_liskov
//docker attach :连接到正在运行中的容器。
C:UsersAdministrator>docker attach 7bcdd684fed4
^C // Ctrl+C
root@7bcdd684fed4:/# cd /data/sites/crm_apple/
root@7bcdd684fed4:/data/sites/crm_apple#