InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Docker tutorials

  • Docker quick start guide on Mac
  • Docker quick start guide on Ubuntu
  • Docker how to add a user to group docker on Linux
  • Docker container - handy commands
  • How to get docker container IP
  • Run nginx in docker container
  • Ubuntu docker - storage driver aufs not supported error
  • How to find docker host ip on Mac
  • Docker - how to rerun a container with different flags
  • Docker managing images - command line cheat sheet
  • Install nginx and php in docker ubuntu container
 
  • Home
  • > Tutorials
  • > Docker

Docker quick start guide on Ubuntu

on Feb 4, 2016

Docker is an open-source project that automates the deployment of applications inside software containers. Here is Docker quick start guide on Ubuntu Linux. We’ll use Ubuntu 14.04.2 LTS for the purpose of this tutorial.

  1. Add pgp key
    $ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
    
  2. Update apt sources

    ## On Ubuntu Trusty 14.04 (LTS)
    $ sudo sh -c "echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list"
    
    ## On Ubuntu Vivid 15.04
    $ sudo sh -c "echo 'deb https://apt.dockerproject.org/repo ubuntu-vivid main' > /etc/apt/sources.list.d/docker.list"
    
    ## Ubuntu Wily 15.10
    $ sudo sh -c "echo 'deb https://apt.dockerproject.org/repo ubuntu-wily main' > /etc/apt/sources.list.d/docker.list"
    
  3. Verify if apt will pull from the right repository

    $ apt-cache policy docker-engine
    

    Update apt package index

    $ sudo apt-get update
    
  4. Install docker and start the docker service
    $ sudo apt-get install docker-engine
    $ sudo service docker start
    
  5. To validate id docker is running:

    $ sudo docker run hello-world
    
  6. Pull latest ubuntu image
    docker pull ubuntu
    Using default tag: latest
    latest: Pulling from library/ubuntu
    
    92ec6d044cb3: Pull complete 
    2ef91804894a: Pull complete 
    f80999a1f330: Pull complete 
    6cc0fc2a5ee3: Pull complete 
    Digest: sha256:457b05828bdb5dcc044d93d042863fba3f2158ae249a6db5ae3934307c757c54
    Status: Downloaded newer image for ubuntu:latest
    
  7. Run ubuntu bash in docker and create container named ubuntu1
    $ sudo docker run -it --name ubuntu1 ubuntu bash
    

    In docker ubuntu shell

    $ python --version
    bash: python: command not found
    $ apt-get install python
    $ python --version
    Python 2.7.6
    

Note on “Cannot connect to the Docker daemon” error

If you get this error:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

This could be due to current user not being in docker group. If you run docker command with sudo this may not happen. In long term, you should add the user to docker group.

Suggested posts:

  1. How to use wildcard in robots.txt
  2. Mac – how to convert mp4 to webm
  3. Docker – how to rerun a container with different flags
  4. document querySelector examples
  5. Docker container – handy commands
  6. Centos/RHEL – find package for a file
  7. Chrome extension tutorial – access active page dom
  8. Mac – find which process is listening on a port
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Docker, Tutorials, Ubuntu Linux
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress