# listen using the default unix socket, and on 2 specific IP addresses on this host. $ sudo dockerd -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2
$ dockerd -D --tls=true --tlscert=/var/docker/server.pem --tlskey=/var/docker/serverkey.pem -H tcp://192.168.59.3:2376 $ sudo nohup docker -d --log-level warn -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock > docker.log & { "debug": true, "tls": true, "tlscert": "/var/docker/server.pem", "tlskey": "/var/docker/serverkey.pem", "hosts": ["unix:///var/run/docker.sock","tcp://0.0.0.0:2375"] }
--config string Location of client config files (default "/home/james/.docker") docker --config
$ docker ps Cannot connect to the Docker daemon. Is the docker daemon running on this host? E0307 06:52:52.025652 53165 container_manager.go:492] list containers[[running]] error: Get http://unix.sock/containers/json?filters=%7B%22status%22%3A%5B%22running%22%5D%7D: dial unix /var/run/docker.sock: connect: permission denied.
$ ll /var/run/docker.sock srw-rw----. 1 root docker 0 Mar 6 17:22 /var/run/docker.sock
sudo gpasswd -a ${USER} docker $ dockerd -h | grep sock --containerd Path to containerd socket -G, --group=docker Group for the unix socket -H, --host=[] Daemon socket(s) to connect to $ dockerd -G dockerroot --raw-logs
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \ --default-runtime=docker-runc \ --exec-opt native.cgroupdriver=systemd \ --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
$ cat /etc/docker/daemon.json { "log-level":"warn", "hosts": ["unix:///var/run/docker.sock","tcp://0.0.0.0:2375"], "runtimes": { "docker-runc": { "path": "/usr/libexec/docker/docker-runc-current" } }, "add-runtime": "docker-runc=/usr/libexec/docker/docker-runc-current", "default-runtime": "docker-runc" } docker -d --log-level warn -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
--data-root string Root directory of persistent Docker state (default "/var/lib/docker") --pidfile string Path to use for daemon PID file (default "/var/run/docker.pid") -H, --host list Daemon socket(s) to connect to (default []) ./dockerd --config-file daemon.json --raw-logs --log-level warn --data-root ./data/ --pidfile ./docker.pid -H tcp://0.0.0.0:2376 -H unix:///home/bin/docker/docker-17.12.1/docker/docker.sock
msg="Handler for POST /containers/create returned error: mkdir /mnt/resource/data/docker/overlay2/4e32760280d0f8a6beefb2823a5c0534a11234e80165feae6bd4e5e7c0076d4c-init/merged/dev/shm: invalid argument"
$ docker info Containers: 1 Running: 1 Paused: 0 Stopped: 0 Images: 39 Server Version: 17.12.1-ce Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: $ uname -r 3.10.0-327.13.1.el7.x86_64
{ "log-level": "warn", "hosts": ["unix:///var/run/docker.sock","tcp://0.0.0.0:2375"], "storage-driver": "devicemapper" }
安裝docker能夠採用yum安裝,軟件包安裝,或者直接使用二進制可執行文件。可是直接使用二進制可執行文件可能會有各類依賴問題,yum安裝是最方便的方式。linux
原本覺得用yum安裝是萬無一失的,可是仍是出現瞭如下錯誤:容器能夠建立可是沒法運行,不映射端口能夠運行,映射端口就報錯。說找不到docker-proxy。yum安裝的也確實沒有docker-proxydocker
Failed in starting container: API error (404): driver failed programming external connectivity on endpoint 1.ac_18_0_yztest-c_0-0-2_13_0_151a31de3de2cead (ea11474a0a341c7500d931e72b7d5f207c1be2d1d51158444aa101122dfad2b7): exec: "docker-proxy": executable file not found in $PATH. $ docker run -d -p 9000:9000 --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /opt/portainer:/data portainer/portainer 4dc93965c584be10704ee5b0d0a1c14a1eabb1e2082a98095992065bd65dbf7b /usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint sleepy_boyd (99fda3a8fba386e88ef362b8f8059ea3d55fa734b353d6e6cdba6c345e5b9a34): Bind for 0.0.0.0:9000 failed: port is already allocated.