Docker Learning notes-open Docker remote access

Source: Internet
Author: User

By default, the Docker daemon generates a socket (/var/run/docker.sock) file for local process communication without listening to any ports, so you can only use the Docker client locally or use the Docker API to do the operation.
If you want to operate the Docker host on another host, you need to have the Docker daemon listen on a port to enable remote communication.

Modify the Docker service startup configuration file, add an unoccupied port number, and restart the Docker daemon.

# Vim/etc/default/docker
docker_opts= "-H 0.0.0.0:5555"
# service Docker restart

It is found that the Docker daemon is already listening on port 5555 and can access the Docker process through that port on another host.

# docker-h ip:5555 Images

But we find that there is a problem with local operation Docker.

# Docker Images
fata[0000] cannot connect to the Docker daemon. Is ' docker-d ' running to this host?

This is because the Docker process only has remote access enabled, and local socket access is not turned on. We modify the/etc/default/docker and then reboot.

# Vim/etc/default/docker
docker_opts= "-H unix:///var/run/docker.sock-h 0.0.0.0:5555"
# service Docker Restart

The Docker process is now accessible both locally and remotely.


Reference documentation
1. http://longgeek.com/2014/09/14/remote-call-docker-api/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.