You can install docker by following below commands
docker run hello-world
- wget -qO- https://get.docker.com/ | sh The above command downloads and executes a small installation script written by the Docker team.
- Docker daemon will be run automatically after installation. To check whether it is running, use following command
sudo service docker status - The docker daemon binds to a Unix socket (/var/run/docker.sock) instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo.
For this reason, docker daemon always runs as the root user. - "docker" binary acting as a client of daemon also needs to be run as a root.
- To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.
sudo usermod -aG docker <user> - We can use -H/--host flag (specify daemon socket to connect to) to specify different interface and port configuration. For example, binding to the network
sudo /usr/bin/docker -d -H tcp://0.0.0.0:2375
above command would bind to all interfaces of host. - Client will not become informed about interface change automatically. You have to pass -H flag while running commands
docker -H :2375 - If you do NOT want to give the -H flag in every command, you can export environment variable export
DOCKER_HOST="tcp://0.0.0.0:2375"
docker run hello-world
No comments:
Post a Comment