Docker

Container Orchestration

Manage Images

Size on disk

volumes
/var/lib/docker# du -sh volumes/
containers
/var/lib/docker# du -sh containers/
images
sudo du -sh /var/lib/docker/image/
devicemapper
sudo cd /var/lib/docker && sudo du -sh devicemapper/
sudo cd /var/lib/docker && sudo du -sh devicemapper/mnt
sudo cd /var/lib/docker && sudo du -sh devicemapper/devicemapper

Starting and stopping

start docker service
$ sudo service docker start or $ /bin/systemctl start docker.service
list images
$ sudo docker images
remove image
$ sudo docker rmi [image]
remove all images
$ sudo docker rmi -f $(sudo docker images -aq)

before images can be removed, containers based on the image have to be deleted

list containers

only running containers
$ sudo docker ps
all containers
$ sudo docker ps -a

stop containers

stop container
$ sudo docker stop CONTAINER_IMAGE

remove containers

remove all containers
$ sudo docker rm $(sudo docker ps -aq)

Docker Engine

Training

Installation

Debian

Fedora

Red Hat Enterprise Linux

Requirements

Red Hat Enterprise Linux 6.5 Installation You will need 64 bit RHEL 6.5 or later, with a RHEL 6 kernel version 2.6.32-431 or higher as this has specific kernel fixes to allow Docker to work.

check kernel version
$ uname -r

Docker is available for RHEL6.5 on EPEL. Please note that this package is part of Extra Packages for Enterprise Linux (EPEL), a community effort to create and maintain additional packages for the RHEL distribution.

Installation

To proceed with docker-io installation, you may need to remove the docker package first.
$ sudo yum -y remove docker
Next, let’s install the docker-io package which will install Docker on our host.
$ sudo yum install docker-io
To update the docker-io package
$ sudo yum -y update docker-io
Now that it’s installed, let’s start the Docker daemon.
$ sudo service docker start (or $ sudo systemctl start docker)
If we want Docker to start at boot, we should also:
$ sudo chkconfig docker on
Now let’s verify that Docker is working.
$ sudo docker run -i -t fedora /bin/bash

Note: If you get a Cannot start container error mentioning SELinux or permission denied, you may need to update the SELinux policies. This can be done using sudo yum upgrade selinux-policy and then rebooting. Done!

Transfer Image

save
docker save -o <save image to path> <image name>
load
docker load -i <path to image tar file>

R (Rocker)



Published

08 August 2015

Category

technical