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