Monday, October 31, 2016

Installing and running the docker daemon remotely.

Step-1: Installing the Docker
         sudo apt-get install docker.io
After installing, docker will start running automatically.
Step -2: Stoping the docker
         sudo service docker stop

Step-3: configuring the docker
  
sudo docker -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -d &
This will make the docker daemon to listen through unix socket and the TCP port


Now access the docker daemon 
example-1
  docker -H=tcp://120.126.17.39:2375 run ubuntu


example-2
   docker run ubuntu

example-3
  docker -H=tcp://120.126.17.39:2375 ps -a


example-4
    docker ps -a


For uninstalling use following command
  sudo apt-get purge --auto-remove docker.io
 



When docker-engine is install, I found the command is slightly different from the previous one.
To install docker-engine:  [src]
        sudo apt-get install docker-engine
Stop the docker:
        sudo service docker stop
Following command will enable the docker to listen using both Linux socket and tcp:
          sudo dockerd -H unix:///var/run/docker.sock H tcp://0.0.0.0:2375
Now to access docker daemon:
          sudo docker -H tcp://0.0.0.0:2375 
                 or 
          sudo docker -H tcp://120.126.16.34:2375

tcp://120.126.16.34:2375 is the IP of the daemon host. The IP of daemon host can be different based on your configuration.

No comments:

Post a Comment