一、Linux
1、拉取映象
docker pull hub.c.163.com/library/oraclelinux:latest
2、建立linux容器
C:\Users\K-Jso>docker images -a REPOSITORY TAG IMAGE ID CREATED SIZE hub.c.163.com/library/php 7.1 6cd3037a948f 6 months ago 371MB hub.c.163.com/library/oraclelinux latest 9fe41720f939 7 months ago 229MB hub.c.163.com/library/redis 4.0.1 d4f259423416 7 months ago 106MB hub.c.163.com/library/nginx latest 46102226f2fd 10 months ago 109MB hub.c.163.com/library/mysql 5.6 0977f3a915e5 10 months ago 298MB C:\Users\K-Jso>docker run --name linux -it -d 9fe41720f939 /bin/bash 04d7d2d30543f983fdd329f6f23d235b2229291063211e1a5f514636f26310e3
3、執行容器,進入容器進行互動(我使用vscode docker 外掛進行管理)
Windows PowerShell 版權所有 (C) Microsoft Corporation。保留所有權利。 PS D:\SMZDM\projects\new_crm> docker exec -it 04d7d2d30543f983fdd329f6f23d235b2229291063211e1a5f514636f26310e3 /bin/sh sh-4.2# /bin/bash [root@04d7d2d30543 /]#
[root@6c9853a071ef /]# ll total 48 lrwxrwxrwx 1 root root 7 Aug 8 2017 bin -> usr/bin dr-xr-xr-x 2 root root 4096 Aug 30 2016 boot drwxr-xr-x 5 root root 360 Jun 26 06:11 dev drwxr-xr-x 1 root root 4096 Jun 26 06:06 etc drwxr-xr-x 2 root root 4096 Aug 30 2016 home lrwxrwxrwx 1 root root 7 Aug 8 2017 lib -> usr/lib lrwxrwxrwx 1 root root 9 Aug 8 2017 lib64 -> usr/lib64 drwxr-xr-x 2 root root 4096 Aug 30 2016 media drwxr-xr-x 2 root root 4096 Aug 30 2016 mnt drwxr-xr-x 2 root root 4096 Aug 30 2016 opt dr-xr-xr-x 134 root root 0 Jun 26 06:11 proc dr-xr-x--- 2 root root 4096 Aug 8 2017 root drwxr-xr-x 12 root root 4096 Aug 8 2017 run lrwxrwxrwx 1 root root 8 Aug 8 2017 sbin -> usr/sbin drwxr-xr-x 2 root root 4096 Aug 30 2016 srv dr-xr-xr-x 13 root root 0 Jun 26 06:08 sys drwxrwxrwt 7 root root 4096 Aug 8 2017 tmp drwxr-xr-x 13 root root 4096 Aug 8 2017 usr drwxr-xr-x 18 root root 4096 Aug 8 2017 var [root@6c9853a071ef /]#