Docker Learning Note 20:docker Daemon configuration and startup

Source: Internet
Author: User
Tags curl

After installing Docker, you need to start the Docker daemon. There are several ways to start.

First, the way of service

Because the Docker daemon is installed as a service. Therefore, you can start and stop the Docker daemon through the service, including viewing the status.

sudo start docker//Start

sudo stop docker//stop

sudo status Docker//view status

Second, using the Docker daemon command

sudo docker daemon

Use sudo ps-a to get the daemon's process number

Third, let the remote API can access the Docker daemon

sudo docker daemon-h tcp://0.0.0.0:2375

This takes parameters every time and cannot be started by the service.

Remote access can also be made available by configuring the configuration file for the service to start.

For Ubuntu OS, modify the docker_opts settings in the/etc/default/docker file as follows:

# Use Docker_opts to modify the daemon startup options. #DOCKER_OPTS="--dns 8.8.8.8--dns 8.8.4.4"docker_opts="-h=unix:///var/run/docker.sock-h=0.0.0.0:2375"

This allows you to remotely access the Docker when it is started by using sudo start Docker, such as:
Http://192.168.142.138:2375/info//equivalent to local Docker info access

Http://192.168.142.138:2375/containers/json//Return to active container

Http://192.168.142.138:2375/containers/json? all=1 Return all containers

In addition to using Web Access, you can also use Docker commands for remote access, and if Docker is installed on other machines,

Access methods such as: Docker-h 192.168.142.138:2375 Info

Note: You can start the daemon with sudo docker daemon, and then perform local Docker command operations to see the URL of the different commands in the drum log

Under Linux, the URL can be accessed through the Curl tool, because the JSON string is returned, not formatted. You can combine Python commands into formatted JSON to make it look clearer. Such as:

Curl Http://192.168.142.138:2375/images/json | Python-mjson.tool

Docker Learning Note 20:docker Daemon configuration and startup

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.