Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Install Docker server on GNU/Linux

Leer en espanol
Install Docker server on GNU/Linux

Table of contents

The official definition translated verbatim is something like this: Docker is an Open Source platform for developers and Sysadmins to build, load, and run applications. ===

dockerlogoWhat is Linux Docker?

The official definition translated verbatim is something like this:

Docker is an Open Source platform for developers and Sysadmins to build, load, and run applications. It consists of a lightweight, portable execution environment and packaging tools […] as a result it can be deployed faster and run the same application without changes on laptops, Data Centers or virtual machines of any Cloud 

What we are interested in knowing as a summary is:

Docker is a container technology that allows us light virtualization to package environments, system configuration and applications, which we can later deploy on any other system compatible with this type of technology.

Facility 

Debian: 

We added the jessie-backports repositories in /etc/apt/sources.list 

text
deb http://http.debian.net/debian jessie-backports main

We update the repositories and install Docker.io

Bash
sudo apt-get update
sudo apt-get install docker.io

Red hat/Centos 7 via repository: 

We add repository in /etc/yum.repos.d/docker.repo

config
/etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

We update the repositories and install Docker

Bash
yum update
yum install docker-engine

Script installation:

Bash
curl -sSL https://get.docker.com/ | sh

We add our user to the docker group

usermod -aG docker rokitoh

We start the daemon:

Bash
[root@docker ~]# service docker start

Starting docker (via systemctl): [ OK ]

View information:  docker info

Captura de pantalla de 2015-08-26 16:42:30

Using the docker search command we can search for the different images (CentOS, Debian, Fedora...) in this image I have proceeded to search for centOS:

Captura de pantalla de 2015-08-26 16:39:51

We download the images and then run them in a container: docker pull centos

Captura de pantalla de 2015-08-26 16:48:05

Once downloaded, we can view the images using the command: docker images

Captura de pantalla de 2015-08-26 16:50:22

Create a container

To create a container we execute the following command: docker run

text
Sintaxis: docker run <IMAGEN> <COMANDO_INICIAL>

Example:

text
docker run -i -t debian /bin/bash

We can also create a container with a specific name with the option: -yam

text
docker run –name redorbita debian /bin/bash

If we had not downloaded the image in question, I would download it and install the container.

List containers: docker ps

If we execute "docker ps" It will only show the containers started and through the option "to" We will display all the containers.

Captura de pantalla de 2015-08-26 16:59:48

Start/stop a container: docker stop/start <container ID>

In order to start or stop a container we can do it using the container ID or by the name that we have given it.

Captura de pantalla de 2015-08-26 17:04:07

Save changes made to the container: docker commit <container ID> <container name>

We need to save all the changes made to the container because if we don't do it when it stops we will lose all the information

Captura de pantalla de 2015-08-26 17:09:06

Delete container: docker rm <container ID/container name>

text
docker rm af2e3a87396d
docker rm redorbita

Regards, Rokitoh

:wq!

Comments