Difference between revisions of "Docker.io Howto"

From Cactus Howto
Jump to navigationJump to search
Line 1: Line 1:
== Basics ==
A running instance of an image is called container. You can make changes to a container (e.g. delete a file), but these changes will not affect the image. However, you can create a new image from a running container (and all it changes) using docker commit <container-id> <image-name>.
== Setup ==
== Setup ==
Beispiel auf Ubuntu 14.04.1 System:
sample docker running under Ubuntu 14.04.1:
itsecorg@pbuilder:~$ sudo aptitude install docker.io
itsecorg@pbuilder:~$ sudo aptitude install docker.io


Line 66: Line 68:
ubuntu 14.04.1 5506de2b643b 3 weeks ago 199.3 MB
ubuntu 14.04.1 5506de2b643b 3 weeks ago 199.3 MB
itsecorg@pbuilder:~$
itsecorg@pbuilder:~$

=== Create new image ===

docker commit <container-id> <image-name>

Revision as of 16:09, 14 November 2014

Basics

A running instance of an image is called container. You can make changes to a container (e.g. delete a file), but these changes will not affect the image. However, you can create a new image from a running container (and all it changes) using docker commit <container-id> <image-name>.

Setup

sample docker running under Ubuntu 14.04.1:

itsecorg@pbuilder:~$ sudo aptitude install docker.io

Set proxy for docker:

itsecorg@pbuilder:~$ grep http_proxy /etc/default/docker.io
export http_proxy="http://proxy.int.cactus.de:8080/"
sudo service docker.io restart

Image and Container Handling

Search images

sudo docker search -s 4 "ubuntu"
NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                                   Official Ubuntu base image                      934       [OK]
dockerfile/ubuntu                        Trusted automated Ubuntu (http://www.ubunt...   32                   [OK]
crashsystems/gitlab-docker               A trusted, regularly updated build of GitL...   21                   [OK]
ansible/ubuntu14.04-ansible              Ubuntu 14.04 LTS with ansible                   21                   [OK]
clue/ttrss                               The Tiny Tiny RSS feed reader allows you t...   19                   [OK]
mbentley/ubuntu-django-uwsgi-nginx                                                       17                   [OK]
sylvainlasnier/memcached                 Memcached docker images based on Ubuntu 14...   17                   [OK]
ubuntu-upstart                           Upstart is an event-based replacement for ...   16        [OK]
dockerfile/ubuntu-desktop                Trusted automated Ubuntu Desktop (LXDE) (h...   14                   [OK]
tutum/ubuntu                             Ubuntu image with SSH access. For the root...   13                   [OK]
tinyerp/ubuntu-openerp                   Run OpenERP on Ubuntu - September 2014          10
itsecorg@pbuilder:~$

Install / list / remove images

sudo docker pull ubuntu

Display installed images:

itsecorg@pbuilder:~$ sudo docker images ubuntu
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              utopic              277eb4304907        3 weeks ago         228.5 MB
ubuntu              14.10               277eb4304907        3 weeks ago         228.5 MB
ubuntu              14.04               5506de2b643b        3 weeks ago         199.3 MB
ubuntu              14.04.1             5506de2b643b        3 weeks ago         199.3 MB
ubuntu              latest              5506de2b643b        3 weeks ago         199.3 MB
ubuntu              trusty              5506de2b643b        3 weeks ago         199.3 MB
ubuntu              12.04               0b310e6bf058        3 weeks ago         126.7 MB
ubuntu              12.04.5             0b310e6bf058        3 weeks ago         126.7 MB
ubuntu              precise             0b310e6bf058        3 weeks ago         126.7 MB
ubuntu              12.10               c5881f11ded9        4 months ago        172.2 MB
ubuntu              quantal             c5881f11ded9        4 months ago        172.2 MB
ubuntu              13.04               463ff6be4238        4 months ago        169.4 MB
ubuntu              raring              463ff6be4238        4 months ago        169.4 MB
ubuntu              13.10               195eb90b5349        4 months ago        184.7 MB
ubuntu              saucy               195eb90b5349        4 months ago        184.7 MB
ubuntu              10.04               3db9c44f4520        6 months ago        183 MB
ubuntu              lucid               3db9c44f4520        6 months ago        183 MB
itsecorg@pbuilder:~$

Remove

Remove Container

itsecorg@pbuilder:~$ sudo docker rm busybox

Remove Image(s)

itsecorg@pbuilder:~$ sudo docker rmi 0b310e6bf058 c5881f11ded9  463ff6be4238 195eb90b5349 3db9c44f4520


Better:

sudo docker pull ubuntu:14.04.1
itsecorg@pbuilder:~$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              14.04.1             5506de2b643b        3 weeks ago         199.3 MB
itsecorg@pbuilder:~$

Create new image

docker commit <container-id> <image-name>