啓動命令docker
buildjson
root@swoole_dev:/home/tb/my_docker_helloworld# docker build -t 192.168.1.8:5000/hello_docker:latest . Sending build context to Docker daemon 916.5kB Step 1/3 : FROM scratch ---> Step 2/3 : ADD hello / ---> Using cache ---> 11b009df24b2 Step 3/3 : CMD ["/hello"] ---> Using cache ---> 6c539eb137dd Successfully built 6c539eb137dd Successfully tagged 192.168.1.8:5000/hello_docker:latest ## 驗證image root@swoole_dev:/home/tb/my_docker_helloworld# docker images |grep 192 192.168.1.8:5000/hello_docker latest 6c539eb137dd 21 hours ago 913kB root@swoole_dev:/home/tb/my_docker_helloworld#
驗證服務端vim
root@swoole_dev:/home/tb/my_docker_helloworld# telnet 192.168.1.8 5000 Trying 192.168.1.8... Connected to 192.168.1.8. Escape character is '^]'.
嘗試pushapi
root@swoole_dev:/home/tb/my_docker_helloworld# docker push 192.168.1.8:5000/hello_docker:latest The push refers to repository [192.168.1.8:5000/hello_docker] Get https://192.168.1.8:5000/v2/: http: server gave HTTP response to HTTPS client root@swoole_dev:/home/tb/my_docker_helloworld# ## 應該是安全策略問題,http vs https
解決辦法安全
vim /etc/docker/deamon.json ## 增長第二行 { "registry-mirrors": ["http://d1d9aef0.m.daocloud.io"], "insecure-registries":["192.168.1.8:5000"] } ## 驗證結果1 root@swoole_dev:/home/tb/my_docker_helloworld# vim /etc/docker/daemon.json root@swoole_dev:/home/tb/my_docker_helloworld# service docker restart root@swoole_dev:/home/tb/my_docker_helloworld# docker push 192.168.1.8:5000/hello_docker:latest The push refers to repository [192.168.1.8:5000/hello_docker] 096f9105d9f4: Pushed latest: digest: sha256:dc9c69395640d5fd7cb9e4f8bd2bdbf788b206a59e942a2a40577d9b1c089934 size: 527 root@swoole_dev:/home/tb/my_docker_helloworld#
客戶端經過registry api 查看swoole
若是未成功,嘗試以下操做ui
vim /lib/systemd/system/docker.service #增長一行 EnvironmentFile=-/etc/docker/daemon.json