SoFunction
Updated on 2025-03-10

Detailed explanation of installing and using Docker on Ubuntu 14.04

Docker is an open source software that encapsulates a Linux application and everything it depends on (such as configuration files) into a container. However, Docker is different from virtual machines, which uses a sandboxing mechanism. Docker containers do not run the operating system, and it shares the operating system on the host. Below I will install and use Docker in Ubuntu 14.04.

Docker enables more applications to run on the same server—it is by providing an additional layer of abstraction and operating system-level virtual automation. Docker is developed in Go and released under the Apache 2.0 license agreement.

1. Docker requirements

To install Docker on Ubuntu 14.04 x64, you need to make sure that the version of Ubuntu is 64-bit and the kernel version must be greater than version 3.10.

1. Check the kernel version of Ubuntu

# uname -r 
3.13.0-55-generic

2. Update the system to ensure the validity of the software package list

# apt-get update

3. If the Ubuntu version is not satisfied, you still need to upgrade Ubuntu

# apt-get -y upgrade

2. Install Docker

Once all the above requirements are met, you can start installing Docker. Docker initially only supported Ubuntu, and later it had CentOS and other RedHat-related release packages. The installation is very simple, execute the command:

# apt-get -y install 

3. Create a link

Create a soft link

 # ln -sf /usr/bin/ /usr/local/bin/docker
 # sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/

4. Check Docker Services

To verify the status of the Docker service, execute the following command to ensure that the Docker service is started.

# service  status
 start/running, process 14394

To run Docker as a daemon, execute the following command: (Note that you need to close the Docker service first)

# docker -d &

5. Docker self-start service

Install Docker as a self-start service, let it run automatically as the server starts, and execute the command:

#   defaults

6. Docker usage

Let’s talk about the usage of Docker. To view the commands that Docker can use, run the docker command in the terminal, which prints a list of all available commands and usage descriptions.

# docker

7. Docker container download

Next, we have the docker command with pull option to pull an image, that is, download a Docker image from the software repository of the Docker registration server.

The commands used are as follows:

# docker pull ubuntu

This command will take some time to execute.

8. Run Docker container

You can now see that it is very simple to create an Ubuntu container under the Bash Shell, just run a line of commands.

-i option: Let the input and output be performed on the standard console

-t option: Assign a tty

# docker run -i -t ubuntu /bin/bash
root@696d5fd32bba:/#

Therefore, in the output prompt, you can see the standard Ubuntu container used.

Bash Shell is now available in Ubuntu's Docker container. If you want to stop/disconnect, you can use the key combination Ctrl-p + Ctrl-q and then it will return to the earlier window.

9. Docker group

Create a docker user group, avoid using root users, and allow users of the docker user group to have the same root permissions.

# usermod -aG docker ubuntu

You can now log out of the current user and log in with the docker user.

10. Docker test

Execute the following command to view the output:

docker@ubuntu-14:/root$ docker run hello-world

The output in the snapshot shows that the docker user is working normally.

11. Docker containers available

Docker's available containers can be found through search commands, and the community has provided many available containers. How to find available Docker containers, search for Docker containers for CentOS using the following command.

# docker search centos

12. Conclusion

This article is an introductory article for Docker, and you will face many challenges if you continue to go deeper.

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.