Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation method and basic usage of Docker on Ubuntu 15.04

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the installation method and basic usage of Docker on Ubuntu 15.04. interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the installation method and basic usage of Docker on Ubuntu 15.04"!

Docker is an open source project that provides an open platform for developers and system administrators to package and run applications anywhere as a lightweight container. Docker automatically deploys the application within the software container. Docker was originally developed by Solomon Hykes as an internal development project of dotCloud, an enterprise-class PaaS (platform as a service Services platform), which is now maintained by the Docker community and Docker. More Docker information can be accessed at https://docs.docker.com/.

We can know what Dock is more vividly through the official pictures of KVM and Docker provided by Docker:

Requirements for installing Docker: a system with a 64-bit architecture and a Linux 3.10 kernel or later are required. Here the author uses the 3.19 kernel version of the Ubuntu15.04 system.

First, learn more about Docker

Here you can learn the most basic conditions of the docker world.

Docker Images

Docker image is the most basic template for Docker container. Image generic containers make systems and applications easy to install, Docker image is a container for running, you can find a lot of images (a variety of operating systems and software have been installed Docker) here https://hub.docker.com/.

Docker Container

The Docker container (Docker Container) is an Image that reads and writes on the running Docker image. Docker is a federated file system that acts as a container background, and any changes to the container will be saved on a new layer of basic image. The layer on which we install the application is the container. Each container running on the host is independent, so it provides a secure application platform.

Docker Registry

Docker registry is a library provided for Docker images. It provides both public and private libraries. The public Docker library is called Docker Hub. Here we can upload push and pull our own images.

Second, install Docker on Ubuntu 15.04

Here we will show you how to install docker. We need to check the kernel version and operating system architecture before installing.

Run the command:

Uname-a

You can see that we are using the ubuntu 15.04 64-bit version and the kernel 3.19 kernel.

Now run the command to install Docker:

Sudo apt-get install-y docker.io

Waiting for the installation to complete, now let's start Docker with the following command:

Systemctl start docker

Enable docker when running system boot, command:

Systemctl enable docker

You may want to check the docker version:

Docker version

Docker is now installed on your system. You can download containers made by Docker Image from the Docker library.

III. The basic usage of Docker

In this section, I'll introduce you to common options for the Docker command. Examples include how to download a docker image, create a container, and how to access the container.

To create a new container, you should choose a basic image operating system, such as booting Ubuntu or CentOS or other systems. You can search for a basic image using the Docker search command:

Docker search ubuntu

This command will display all ubuntu images, you can try to search for centos Images yourself.

Now we base image into our service, using the command:

Docker pull ubuntu

You can now view all downloaded images by using the command:

Docker images

The Ubuntu image is downloaded from DockerHub/Docker Registry. The next step is to create a container from the mirror.

To create a container, you can use docker create or docker run.

Docker create ubuntu:14.04

The docker create command creates a new container, but does not start it. So, now you need to use the run command:

Docker run-I-t ubuntu:14.04 / bin/bash

This command will create and run a container based on the Ubuntu14.04 image, and run a command / bin/bash inside the container, and you will automatically run the command inside the container.

When you type the Exit command to exit the container, the container also stops running. If you want the container to run in the background, you need to add the-d parameter to the command.

Docker run-I-t-d ubuntu:14.04 / bin/sh-c "while true; do echo hello world; sleep 1; done" / bin/sh-c "while true; do echo hello world; sleep 1; done" this is bash script to echo "hello word" forever.

Now you can see the container running in the background with the command:

Docker ps

If you want to see the log results from the bash command, use the command:

Docker logs NAMES/ContainerID

How to access the container shell in the background? This command will connect to your container shell:

Docker exec-I-t NAMES/ContainerID

You can see that the hostname is equal to the container ID, which means you are in the container shell. When you type 'exit` on shell, the shell will leave, but the container is still running.

Another command you will often use is:

Docker stop NAME/ContainerID

This will stop the container without deleting it, so you can restart it with the command:

Docker start NAME/ContainerID

If you want to delete the container, stop it first, and then delete it with the command:

Docker rm NAME/ContainerID so far, I believe you have a deeper understanding of "the installation method and basic usage of Docker on Ubuntu 15.04". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report