Installing Docker on Ubuntu 16.04

Posted on Wednesday, April 5, 2017








I am going to do a simple install of Docker on Ubuntu 16.04

The official docker install guide for ubunt can be found at https://docs.docker.com/engine/installation/linux/ubuntu/#prerequisites

I will be installed Docker CE (Community Edition) not Docker EE (Enterprise Edition)




Installation


Update apt-get and install extra tools


  > sudo apt-get update
  > sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common


Add the docker official GPG key


  > curl -fsSL \
https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -


Add the docker repo


  > sudo add-apt-repository \
   "deb [arch=amd64] \
   https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"




Update again and install docker


  > sudo apt-get update
  > sudo apt-get install docker-ce -y



That's it! 




Testing


Now test it real quick


  > sudo docker run hello-world





Worked!

Let me done something a little more interesting as a test.



  >  sudo docker run -p 8080:80 nginx


This should download the nginx docker image and runs it locally and connects its port 80 to local port 8080.


Then from another terminal run this


  >  curl localhost:8080




You should get back a web page. 






And there is the docker logs from the running docker nginx image.


Or you could open the URL directly

http://192.168.0.88:8080/   (replace with your IP address of course)






OK that is enough for this simple article. Docker is installed tested.




References


[1]        Install Docker on Ubuntu guide



No comments:

Post a Comment