Docker for Windowsのインストール

docker.comからダウンロードする。
ダウンロードにはDockerのアカウントが必要。64bit環境のみしか実行できない。

Dockerインストール1 width=480

Dockerインストール2 width=480

Dockerインストール3 width=480

Windowsの機能でHyper-Vが有効化されていない場合、インストールの中で有効化される。

Dockerインストール4 width=480

Dockerインストール5 width=480

Dockerインストール6 width=480

dockerアカウントでログインする。

Dockerインストール7 width=480

共有ドライブを選択する。

Dockerインストール8 width=480

Dockerの起動

1
2
PS > docker --version
Docker version 19.03.5, build 633a0ea

Dockerの起動(CentOS7)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
PS > docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
PS > docker run -it -d --name centos7 centos:centos7
Unable to find image 'centos:centos7' locally
centos7: Pulling from library/centos
ab5ef0e58194: Pull complete
Digest: sha256:4a701376d03f6b39b8c2a8f4a8e499441b0d567f9ab9d58e4991de4472fb813c
Status: Downloaded newer image for centos:centos7
8679da923e5789e8f379451f8f3a17b74f5dc0ba5f9183be16db19807410231a
PS >
PS > docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8679da923e57 centos:centos7 "/bin/bash" 8 seconds ago Up 7 seconds centos7
PS > docker exec -it centos7 /bin/bash
[root@8679da923e57 /]# ls -al
total 64
drwxr-xr-x 1 root root 4096 Dec 10 12:48 .
drwxr-xr-x 1 root root 4096 Dec 10 12:48 ..
-rwxr-xr-x 1 root root 0 Dec 10 12:48 .dockerenv
-rw-r--r-- 1 root root 12123 Oct 1 01:16 anaconda-post.log
lrwxrwxrwx 1 root root 7 Oct 1 01:15 bin -> usr/bin
drwxr-xr-x 5 root root 360 Dec 10 12:48 dev
drwxr-xr-x 1 root root 4096 Dec 10 12:48 etc
drwxr-xr-x 2 root root 4096 Apr 11 2018 home
lrwxrwxrwx 1 root root 7 Oct 1 01:15 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Oct 1 01:15 lib64 -> usr/lib64
drwxr-xr-x 2 root root 4096 Apr 11 2018 media
drwxr-xr-x 2 root root 4096 Apr 11 2018 mnt
drwxr-xr-x 2 root root 4096 Apr 11 2018 opt
dr-xr-xr-x 142 root root 0 Dec 10 12:48 proc
dr-xr-x--- 2 root root 4096 Oct 1 01:16 root
drwxr-xr-x 11 root root 4096 Oct 1 01:16 run
lrwxrwxrwx 1 root root 8 Oct 1 01:15 sbin -> usr/sbin
drwxr-xr-x 2 root root 4096 Apr 11 2018 srv
dr-xr-xr-x 13 root root 0 Dec 10 12:48 sys
drwxrwxrwt 7 root root 4096 Oct 1 01:16 tmp
drwxr-xr-x 13 root root 4096 Oct 1 01:15 usr
drwxr-xr-x 18 root root 4096 Oct 1 01:15 var
[root@8679da923e57 /]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 12:48 pts/0 00:00:00 /bin/bash
root 14 0 1 12:48 pts/1 00:00:00 /bin/bash
root 29 14 0 12:48 pts/1 00:00:00 ps -ef
[root@8679da923e57 /]# exit
exit
PS >
PS > docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos centos7 5e35e350aded 4 weeks ago 203MB

dockerの起動(Ubuntu 18.04)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
PS > docker run -it -d --name ubuntu ubuntu:18.04
Unable to find image 'ubuntu:18.04' locally
18.04: Pulling from library/ubuntu
7ddbc47eeb70: Pull complete
c1bbdc448b72: Pull complete
8c3b70e39044: Pull complete
45d437916d57: Pull complete
Digest: sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d
Status: Downloaded newer image for ubuntu:18.04
9c20fc472edde1e26b19c08c2276c847fa61ed5958f9e1d7328247077fee3710
PS > docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9c20fc472edd ubuntu:18.04 "/bin/bash" 13 seconds ago Up 12 seconds ubuntu
8679da923e57 centos:centos7 "/bin/bash" 5 minutes ago Up 5 minutes centos7
PS > docker exec -it ubuntu /bin/bash
root@9c20fc472edd:/# ls -al
total 72
drwxr-xr-x 1 root root 4096 Dec 10 12:53 .
drwxr-xr-x 1 root root 4096 Dec 10 12:53 ..
-rwxr-xr-x 1 root root 0 Dec 10 12:53 .dockerenv
drwxr-xr-x 2 root root 4096 Oct 29 21:25 bin
drwxr-xr-x 2 root root 4096 Apr 24 2018 boot
drwxr-xr-x 5 root root 360 Dec 10 12:53 dev
drwxr-xr-x 1 root root 4096 Dec 10 12:53 etc
drwxr-xr-x 2 root root 4096 Apr 24 2018 home
drwxr-xr-x 8 root root 4096 May 23 2017 lib
drwxr-xr-x 2 root root 4096 Oct 29 21:25 lib64
drwxr-xr-x 2 root root 4096 Oct 29 21:25 media
drwxr-xr-x 2 root root 4096 Oct 29 21:25 mnt
drwxr-xr-x 2 root root 4096 Oct 29 21:25 opt
dr-xr-xr-x 144 root root 0 Dec 10 12:53 proc
drwx------ 2 root root 4096 Oct 29 21:25 root
drwxr-xr-x 1 root root 4096 Oct 31 22:20 run
drwxr-xr-x 1 root root 4096 Oct 31 22:20 sbin
drwxr-xr-x 2 root root 4096 Oct 29 21:25 srv
dr-xr-xr-x 13 root root 0 Dec 10 12:48 sys
drwxrwxrwt 2 root root 4096 Oct 29 21:25 tmp
drwxr-xr-x 1 root root 4096 Oct 29 21:25 usr
drwxr-xr-x 1 root root 4096 Oct 29 21:25 var
root@9c20fc472edd:/# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 12:53 pts/0 00:00:00 /bin/bash
root 11 0 0 12:54 pts/1 00:00:00 /bin/bash
root 22 11 0 12:55 pts/1 00:00:00 ps -ef
root@9c20fc472edd:/# exit
exit
PS > docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos centos7 5e35e350aded 4 weeks ago 203MB
ubuntu 18.04 775349758637 5 weeks ago 64.2MB