Docker Learning Notes (4)-Turn on Docker remote access

Source: Internet
Author: User

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

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

    1. # Vim/etc/default/docker
    2. docker_opts= "-H 0.0.0.0:5555"
    3. # Service Docker Restart
Copy Code


Now that the Docker daemon is listening on port 5555, the Docker process can be accessed through that port on another host.

    1. # docker-h ip:5555 Images
Copy Code


But we found that there was a problem with Docker operating locally.

    1. # Docker Images
    2. FATA[0000] Cannot connect to the Docker daemon. Is ' docker-d ' running on this host?
Copy Code


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.

    1. # Vim/etc/default/docker
    2. docker_opts= "-H unix:///var/run/docker.sock-h 0.0.0.0:5555"
    3. # Service Docker Restart
Copy Code

The Docker process is now accessible both locally and remotely.

Docker Learning Notes (4)-Turn on Docker remote access

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.