After installation, modify /lib/systemd/system/docker.service:
scnzzh@zubt1:~$ sudo vi /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://10.0.2.7:2375 --containerd=/run/containerd/containerd.sock
Then restart docker:
scnzzh@zubt1:~$ sudo systemctl daemon-reload
scnzzh@zubt1:~$ sudo service docker restart
Run a Docker container on local machine:
scnzzh@zubt1:~/zzh$ docker run hello-world
Run a Docker container on a remote machine:
scnzzh@zubt1:~/zzh$ docker -H 10.0.2.8:2375 run hello-world
List images:
scnzzh@zubt1:~$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest bf756fb1ae65 11 months ago 13.3kB
scnzzh@zubt1:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest bf756fb1ae65 11 months ago 13.3kB
scnzzh@zubt1:~$ curl -X GET http://10.0.2.7:2375/images/json
[{"Containers":-1,"Created":1578014497,"Id":"sha256:bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b","Labels":null,"ParentId":"","RepoDigests":["hello-world@sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec"],"RepoTags":["hello-world:latest"],"SharedSize":-1,"Size":13336,"VirtualSize":13336}]