Containerized Application Development

Running Containers Locally

Link Containers
[root@docker ~]# yum install epel-release -y

[root@docker ~]# yum update -y

[root@docker ~]# yum install docker* -y

[root@docker ~]# setenforce 0

[root@docker ~]# vim /etc/selinux/config
SELINUX=disabled

[root@docker ~]# reboot

[root@docker ~]# systemctl enable docker

[root@docker ~]# systemctl start docker

[root@docker ~]# systemctl status docker

[root@docker ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc pfifo_fast state UP qlen 1000
link/ether 42:01:0a:80:00:02 brd ff:ff:ff:ff:ff:ff
inet 10.128.0.2/32 brd 10.128.0.2 scope global dynamic eth0
valid_lft 86137sec preferred_lft 86137sec
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:38:ff:da:5e brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever

[root@docker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

[root@docker ~]# docker run –detach –name=test1-mysql –env=”MYSQL_ROOT_PASSWORD=password” mysql

Unable to find image ‘mysql:latest’ locally
Trying to pull repository docker.io/library/mysql …
latest: Pulling from docker.io/library/mysql

10a267c67f42: Pull complete
c2dcc7bb2a88: Pull complete
17e7a0445698: Pull complete
9a61839a176f: Pull complete
a1033d2f1825: Pull complete
0d6792140dcc: Pull complete
cd3adf03d6e6: Pull complete
d79d216fd92b: Pull complete
b3c25bdeb4f4: Pull complete
02556e8f331f: Pull complete
4bed508a9e77: Pull complete
Digest: sha256:2f4b1900c0ee53f344564db8d85733bd8d70b0a78cd00e6d92dc107224fc84a5
49c1b121de162f147123a3a37030126ebbf31e3e06520510b64dcd1bba5cb045

[root@docker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mysql latest e799c7f9ae9c 8 days ago 407.3 MB

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
49c1b121de16 mysql “docker-entrypoint.sh” 35 seconds ago Up 34 seconds 3306/tcp test1-mysql
[root@docker ~]# docker inspect test1-mysql |grep -i ipaddress
“SecondaryIPAddresses”: null,
“IPAddress”: “172.17.0.2”,
“IPAddress”: “172.17.0.2”,

[root@docker ~]# mysql -h 172.17.0.2 -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MySQL [(none)]>

MySQL [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| sys |
+——————–+
4 rows in set (0.00 sec)

MySQL [(none)]> \q
Bye
[root@docker ~]#

[root@docker ~]# docker run -d –name test1-wordpress –link test1-mysql:mysql -e=”WORDPRESS_DB_PASSWORD” -e=”WORDPRESS_DB_USER=root” wordpress
Unable to find image ‘wordpress:latest’ locally
Trying to pull repository docker.io/library/wordpress …
latest: Pulling from docker.io/library/wordpress

10a267c67f42: Already exists
370377701f89: Pull complete
455c73a122bc: Pull complete
fb71bac61c47: Pull complete
288a1d91ad4e: Pull complete
86e0256ba4b0: Pull complete
f14fbe7a9dfb: Pull complete
0f36dd91c0ab: Pull complete
97d77fc1fd2c: Pull complete
d8c0a0fd7605: Pull complete
79601c211937: Pull complete
48bba15d4000: Pull complete
96a57b907249: Pull complete
24ed18a8e864: Pull complete
10174a4940d5: Pull complete
b9198f664ee8: Pull complete
b653a25ed3ad: Pull complete
6e8e148761ae: Pull complete
Digest: sha256:35ba258dd73b09ca87836fabab1e166dd87456abdb68a6d361d83200b8337b87
f2fbf2a02ed2c115bb6330a7b145c26229d52c2ecdc87a5763b110bb2fd1de0d

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f2fbf2a02ed2 wordpress “docker-entrypoint.sh” 13 seconds ago Up 12 seconds 80/tcp test1-wordpress
49c1b121de16 mysql “docker-entrypoint.sh” 10 minutes ago Up 10 minutes 3306/tcp test1-mysql

[root@docker ~]# docker exec -it test1-wordpress /bin/bash
root@f2fbf2a02ed2:/var/www/html#

root@f2fbf2a02ed2:/var/www/html# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 mysql 49c1b121de16 test1-mysql
172.17.0.3 f2fbf2a02ed2

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f2fbf2a02ed2 wordpress “docker-entrypoint.sh” 3 minutes ago Up 3 minutes 80/tcp test1-wordpress
49c1b121de16 mysql “docker-entrypoint.sh” 14 minutes ago Up 14 minutes 3306/tcp test1-mysql

[root@docker ~]# docker inspect test1-wordpress |grep -i ipaddress
“SecondaryIPAddresses”: null,
“IPAddress”: “172.17.0.3”,
“IPAddress”: “172.17.0.3”,

[root@docker ~]# elinks http://172.17.0.3

wordpress.png
[root@docker ~]# curl -I http://172.17.0.3
HTTP/1.1 302 Found
Date: Thu, 18 May 2017 19:55:28 GMT
Server: Apache/2.4.10 (Debian)
X-Powered-By: PHP/5.6.30
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Location: http://172.17.0.3/wp-admin/install.php
Content-Type: text/html; charset=UTF-8

[root@docker ~]# mysql -h 172.17.0.2 -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MySQL [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| sys |
| wordpress |
+——————–+
5 rows in set (0.01 sec)

MySQL [(none)]> use wordpress;
Database changed
MySQL [wordpress]> show tables;
Empty set (0.00 sec)

MySQL [wordpress]> \q
Bye
[root@docker ~]# docker exec -it test1-wordpress /bin/bash
root@f2fbf2a02ed2:/var/www/html# set
APACHE_CONFDIR=/etc/apache2
APACHE_ENVVARS=/etc/apache2/envvars
BASH=/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]=”4″ [1]=”3″ [2]=”30″ [3]=”1″ [4]=”release” [5]=”x86_64-pc-linux-gnu”)
BASH_VERSION=’4.3.30(1)-release’
COLUMNS=144
DIRSTACK=()
EUID=0
GPG_KEYS=’0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3′
GROUPS=()
HISTFILE=/root/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/root
HOSTNAME=f2fbf2a02ed2
HOSTTYPE=x86_64
IFS=$’ \t\n’
LINES=41
MACHTYPE=x86_64-pc-linux-gnu
MAILCHECK=60
MYSQL_ENV_GOSU_VERSION=1.7
MYSQL_ENV_MYSQL_MAJOR=5.7
MYSQL_ENV_MYSQL_ROOT_PASSWORD=password
MYSQL_ENV_MYSQL_VERSION=5.7.18-1debian8
MYSQL_NAME=/test1-wordpress/mysql
MYSQL_PORT=tcp://172.17.0.2:3306
MYSQL_PORT_3306_TCP=tcp://172.17.0.2:3306
MYSQL_PORT_3306_TCP_ADDR=172.17.0.2
MYSQL_PORT_3306_TCP_PORT=3306
MYSQL_PORT_3306_TCP_PROTO=tcp
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PHPIZE_DEPS=$’autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tlibpcre3-dev \t\tmake \t\tpkg-config \t\tre2c’
PHP_ASC_URL=https://secure.php.net/get/php-5.6.30.tar.xz.asc/from/this/mirror
PHP_CFLAGS=’-fstack-protector-strong -fpic -fpie -O2′
PHP_CPPFLAGS=’-fstack-protector-strong -fpic -fpie -O2′
PHP_EXTRA_BUILD_DEPS=apache2-dev
PHP_EXTRA_CONFIGURE_ARGS=–with-apxs2
PHP_INI_DIR=/usr/local/etc/php
PHP_LDFLAGS=’-Wl,-O1 -Wl,–hash-style=both -pie’
PHP_MD5=68753955a8964ae49064c6424f81eb3e
PHP_SHA256=a363185c786432f75e3c7ff956b49c3369c3f6906a6b10459f8d1ddc22f70805
PHP_URL=https://secure.php.net/get/php-5.6.30.tar.xz/from/this/mirror
PHP_VERSION=5.6.30
PIPESTATUS=([0]=”1″)
PPID=0
PS1=’${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ‘
PS2=’> ‘
PS4=’+ ‘
PWD=/var/www/html
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
TERM=dumb
UID=0
WORDPRESS_DB_USER=root
WORDPRESS_SHA1=fbe0ee1d9010265be200fe50b86f341587187302
WORDPRESS_VERSION=4.7.5
_=’]’
root@f2fbf2a02ed2:/var/www/html#

#######################################################################################################

Get Container Logs

[root@docker ~]# docker logs test1-wordpress
WordPress not found in /var/www/html – copying now…
Complete! WordPress has been successfully copied to /var/www/html
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.3. Set the ‘ServerName’ directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.3. Set the ‘ServerName’ directive globally to suppress this message
[Thu May 18 19:48:03.750802 2017] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/5.6.30 configured — resuming normal operations
[Thu May 18 19:48:03.750825 2017] [core:notice] [pid 1] AH00094: Command line: ‘apache2 -D FOREGROUND’
172.17.0.1 – – [18/May/2017:19:54:54 +0000] “GET / HTTP/1.1” 302 375 “-” “ELinks/0.12pre6 (textmode; Linux; 144×41-2)”
172.17.0.1 – – [18/May/2017:19:54:54 +0000] “GET /wp-admin/install.php HTTP/1.1” 200 11467 “http://172.17.0.3/&#8221; “ELinks/0.12pre6 (textmode; Linux; 144×41-2)”
172.17.0.1 – – [18/May/2017:19:54:54 +0000] “GET /wp-admin/css/install.min.css?ver=4.7.5 HTTP/1.1” 200 6275 “http://172.17.0.3/wp-admin/install.php&#8221; “ELinks/0.12pre6 (textmode; Linux; 144×41-2)”
172.17.0.1 – – [18/May/2017:19:54:54 +0000] “GET /wp-includes/css/dashicons.min.css?ver=4.7.5 HTTP/1.1” 200 46673 “http://172.17.0.3/wp-admin/install.php&#8221; “ELinks/0.12pre6 (textmode; Linux; 144×41-2)”
172.17.0.1 – – [18/May/2017:19:54:54 +0000] “GET /wp-includes/css/buttons.min.css?ver=4.7.5 HTTP/1.1” 200 6759 “http://172.17.0.3/wp-admin/install.php&#8221; “ELinks/0.12pre6 (textmode; Linux; 144×41-2)”
172.17.0.1 – – [18/May/2017:19:55:28 +0000] “HEAD / HTTP/1.1” 302 300 “-” “curl/7.29.0”

https://docs.docker.com/engine/reference/commandline/logs/

[root@docker ~]# docker logs –tail 5 test1-mysql
2017-05-18T19:37:58.433762Z 0 [Note] mysqld: ready for connections.
Version: ‘5.7.18’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 MySQL Community Server (GPL)
2017-05-18T19:37:58.433770Z 0 [Note] Executing ‘SELECT * FROM INFORMATION_SCHEMA.TABLES;’ to get a list of tables using the deprecated partition engine. You may use the startup option ‘–disable-partition-engine-check’ to skip this check.
2017-05-18T19:37:58.433771Z 0 [Note] Beginning of list of non-natively partitioned tables
2017-05-18T19:37:58.444533Z 0 [Note] End of list of non-natively partitioned tables

Listen to Docker Events on the Docker Host

[root@docker ~]# docker events

[root@docker ~]# docker events –since 2017-05-18

https://docs.docker.com/engine/reference/commandline/events/

Use Docker Inspect

https://docs.docker.com/engine/reference/commandline/inspect/

[root@docker ~]# docker inspect -f ‘{{json .NetworkSettings.Ports}}’ test1-mysql
{“3306/tcp”:null}

[root@docker ~]# docker inspect -f ‘{{json .NetworkSettings.Networks.bridge.IPAddress}}’ test1-mysql
“172.17.0.2”

Share Data Between Containers Expose Containers

[root@docker ~]# docker stop test1-wordpress
test1-wordpress
[root@docker ~]# docker stop test1-mysql
test1-mysql
[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

[root@docker ~]# docker run –detach –name test1-mysql –env=”MYSQL_ROOT_PASSWORD=password” –publish 6603:3306 mysql
e7857cabc58f9861bde524d69dd44e780249732c75a26d525e427466316e9017

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7857cabc58f mysql “docker-entrypoint.sh” 14 seconds ago Up 14 seconds 0.0.0.0:6603->3306/tcp test1-mysql

[root@docker ~]# docker logs test1-mysql

[root@docker ~]# mysql -h 10.128.0.2 -p -P6603
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MySQL [(none)]>

MySQL [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| sys |
+——————–+
4 rows in set (0.00 sec)

MySQL [(none)]> \q
Bye

#####################################################################

Persistent Storage for Containers

https://docs.docker.com/engine/reference/commandline/volume_create/
https://docs.docker.com/engine/reference/commandline/volume_inspect/
https://docs.docker.com/engine/reference/commandline/volume_ls/
https://docs.docker.com/engine/reference/commandline/volume_rm/

[root@docker ~]# docker volume create –name MyVolume1
MyVolume1

[root@docker ~]# docker volume ls
DRIVER VOLUME NAME
local 26f1bd8b75356465ee71364c426907189c3700478a5c3365d57c5361527f7c40
local 8c9a7f879335304c51d1d55778101a2fb1925aed8c2b296ce0828accb3126e20
local MyVolume1
local bd65913d6b2dfa190a753c4369d0d2777d40273eccd7e575c3833c4d0c7bed21

[root@docker ~]# docker run -it -v MyVolume1:/volume1 ubuntu
Unable to find image ‘ubuntu:latest’ locally
Trying to pull repository docker.io/library/ubuntu …
latest: Pulling from docker.io/library/ubuntu

b6f892c0043b: Pull complete
55010f332b04: Pull complete
2955fb827c94: Pull complete
3deef3fcbd30: Pull complete
cf9722e506aa: Pull complete
Digest: sha256:382452f82a8bbd34443b2c727650af46aced0f94a44463c62a9848133ecb1aa8

root@1ec81e2a954c:/# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/docker-8:1-2379212-01c0d3565e485f0d67329ac9b1581189764a78728b923fe79c7a03f4f373f520 xfs 10G 139M 9.9G 2% /
tmpfs tmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 xfs 10G 3.7G 6.4G 37% /volume1
shm tmpfs 64M 0 64M 0% /dev/shm

root@1ec81e2a954c:/# cd  /volumes1

root@1ec81e2a954c:/volume1# echo “this is my content for file1” > file1
root@1ec81e2a954c:/volume1# ls -l
total 4
-rw-r–r– 1 root root 29 May 18 21:11 file1
root@1ec81e2a954c:/volume1# cat file1
this is my content for file1

[root@docker ~]# docker volume inspect MyVolume1
[
{
“Name”: “MyVolume1”,
“Driver”: “local”,
“Mountpoint”: “/var/lib/docker/volumes/MyVolume1/_data”,
“Labels”: {},
“Scope”: “local”
}
]
[root@docker ~]# cd /var/lib/docker/volumes/MyVolume1/_data
[root@docker _data]# ls -l
total 4
-rw-r–r– 1 root root 29 May 18 21:11 file1
[root@docker _data]# cat file1
this is my content for file1
[root@docker _data]#

[root@docker _data]# docker volume rm MyVolume1
Error response from daemon: Unable to remove volume, volume still in use: remove MyVolume1: volume is in use – [1ec81e2a954ce15584dd273cdeb7146c68a4b9da938c955171cecb3165e9de5a]

[root@docker _data]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1ec81e2a954c ubuntu “/bin/bash” 7 minutes ago Exited (0) 4 minutes ago loving_easley
e7857cabc58f mysql “docker-entrypoint.sh” 32 minutes ago Up 32 minutes 0.0.0.0:6603->3306/tcp test1-mysql
f2fbf2a02ed2 wordpress “docker-entrypoint.sh” About an hour ago Exited (0) 36 minutes ago test1-wordpress

[root@docker _data]# docker rm loving_easley
loving_easley

[root@docker _data]# docker volume rm MyVolume1
MyVolume1

[root@docker ~]# docker volume create –name MyVolume2
MyVolume2

[root@docker ~]# docker run -it -v MyVolume2:/mynewvol ubuntu
root@76fc25ad5284:/# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/docker-8:1-2379212-6f82878461995db8bf30da760c7011fe356ef332c95dffb24b446b1d54cecc1f xfs 10G 139M 9.9G 2% /
tmpfs tmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 xfs 10G 3.7G 6.4G 37% /mynewvol
shm tmpfs 64M 0 64M 0% /dev/shm
root@76fc25ad5284:/# exit
[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a6bede8fbb1d ubuntu “/bin/bash” 35 seconds ago Up 35 seconds cranky_archimedes

[root@docker ~]# docker run -it –volumes-from cranky_archimedes ubuntu
root@ef68a395b475:/#

root@ef68a395b475:/# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/docker-8:1-2379212-414343f62dd95f9ef71a753444e58c5e355a7f49d53224c6a4ce03c025e5dedc xfs 10G 139M 9.9G 2% /
tmpfs tmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 xfs 10G 3.7G 6.3G 38% /mynewvol
shm tmpfs 64M 0 64M 0% /dev/shm

root@ef68a395b475:/# cd mynewvol/
root@ef68a395b475:/mynewvol# echo “this is from shared voliume” > file2
root@ef68a395b475:/mynewvol# ls -l
total 4
-rw-r–r– 1 root root 28 May 18 21:36 file2

root@a6bede8fbb1d:/# cd /mynewvol/
root@a6bede8fbb1d:/mynewvol#
root@a6bede8fbb1d:/mynewvol# ls -l
total 0
root@a6bede8fbb1d:/mynewvol# ls -l
total 4
-rw-r–r– 1 root root 28 May 18 21:36 file2

Host and Container Basic Security Best Practices

docker run –pids-limit=64
docker run –security-pot=no-new-privileges
docker –ipc=false
docker –iptables=false
docker run –read-only
docker -c 512 -mem 512m

RUN greoupadd -r user && useradd -r -g user user

Image Registries

[root@docker ~]# docker run -d -p 5000:5000 –restart=always –name registry registry:2
Unable to find image ‘registry:2’ locally
Trying to pull repository docker.io/library/registry …
2: Pulling from docker.io/library/registry

79650cf9cc01: Pull complete
70ce42745103: Pull complete
77edd1a7fa4d: Pull complete
432773976ace: Pull complete
3234a47fe5a9: Pull complete
Digest: sha256:a3551c422521617e86927c3ff57e05edf086f1648f4d8524633216ca363d06c2
f81986114f09052e34cc7fc186a33d3c57145f1af192fd0110b680da5aae221b

[root@docker ~]#docker pull ubuntu
Using default tag: latest
Trying to pull repository docker.io/library/ubuntu …
latest: Pulling from docker.io/library/ubuntu

Digest: sha256:382452f82a8bbd34443b2c727650af46aced0f94a44463c62a9848133ecb1aa8

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f81986114f09 registry:2 “/entrypoint.sh /etc/” About a minute ago Up About a minute 0.0.0.0:5000->5000/tcp registry

[root@docker ~]# docker tag ubuntu localhost:5000/ubuntu

[root@docker ~]# docker push localhost:5000/ubuntu
The push refers to a repository [localhost:5000/ubuntu]
33f1a94ed7fc: Pushed
b27287a6dbce: Pushed
47c2386f248c: Pushed
2be95f0d8a0c: Pushed
2df9b8def18a: Pushed
latest: digest: sha256:382452f82a8bbd34443b2c727650af46aced0f94a44463c62a9848133ecb1aa8 size: 1357

[root@docker ~]# docker pull localhost:5000/ubuntu
Using default tag: latest
Trying to pull repository localhost:5000/ubuntu …
latest: Pulling from localhost:5000/ubuntu

Digest: sha256:382452f82a8bbd34443b2c727650af46aced0f94a44463c62a9848133ecb1aa8

[root@docker ~]# docker pull localhost:5000/ubuntu
Using default tag: latest
Trying to pull repository localhost:5000/ubuntu …
latest: Pulling from localhost:5000/ubuntu

Digest: sha256:382452f82a8bbd34443b2c727650af46aced0f94a44463c62a9848133ecb1aa8

[root@docker ~]# docker stop registry
registry

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

[root@docker ~]# docker start registry
registry

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f81986114f09 registry:2 “/entrypoint.sh /etc/” 7 minutes ago Up 3 seconds 0.0.0.0:5000->5000/tcp registry

[root@docker ~]# docker pull localhost:5000/ubuntu
Using default tag: latest
Trying to pull repository localhost:5000/ubuntu …
latest: Pulling from localhost:5000/ubuntu
Digest: sha256:382452f82a8bbd34443b2c727650af46aced0f94a44463c62a9848133ecb1aa8

[root@docker ~]# docker inspect registry

[root@docker ~]# docker rm -v registry
Error response from daemon: You cannot remove a running container f81986114f09052e34cc7fc186a33d3c57145f1af192fd0110b680da5aae221b. Stop the container before attempting removal or use -f

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f81986114f09 registry:2 “/entrypoint.sh /etc/” 10 minutes ago Up 2 minutes 0.0.0.0:5000->5000/tcp registry

[root@docker ~]# docker stop registry
registry

[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

[root@docker ~]# docker rm -v registry
registry

[root@docker ~]# docker inspect registry
[]
Error: No such image, container or task: registry

Image Design Best Practises

Working with Images

[root@docker images]# vim Dockerfile

FROM ubuntu
RUN mkdir /myvol
RUN echo “hello world”
VOLUME /myvol

[root@docker images]# docker build -t testvol .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM ubuntu
—> ebcd9d4fca80
Step 2 : RUN mkdir /myvol
—> Running in 06d7f7f5bc64
—> 5f28627769f0
Removing intermediate container 06d7f7f5bc64
Step 3 : RUN echo “hello world”
—> Running in 08dab69d7885
hello world
—> 50f47d303535
Removing intermediate container 08dab69d7885
Step 4 : VOLUME /myvol
—> Running in f7d736fe9f85
—> 1c007cae535e
Removing intermediate container f7d736fe9f85
Successfully built 1c007cae535e

[root@docker images]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
testvol latest 1c007cae535e 27 seconds ago 117.9 MB

[root@docker images]# docker run -it testvol

root@72126f136ea1:/# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/docker-8:1-2379212-29e66be01e66ee99d0b26c05adbaf494a1a28af073aac7135c4656f96887adb9 xfs 10G 139M 9.9G 2% /
tmpfs tmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 xfs 10G 3.9G 6.2G 39% /myvol
shm tmpfs 64M 0 64M 0% /dev/shm
root@72126f136ea1:/#

###############################################################

Create Custom Images

Design and Code a dockerfile to Build a Custom Container Image

[root@docker ~]# mkdir mywebsite
[root@docker ~]# cd mywebsite/
[root@docker mywebsite]#

[root@docker mywebsite]# vim index.html
this is from my docker image hosting

[root@docker mywebsite]# vim Dockerfile
FROM centos:6

MAINTAINER rafi494

RUN yum install httpd elinks -y

ADD mainfile.tar.gz /var/www/html

EXPOSE 80

ENTRYPOINT [“/usr/sbin/httpd”,”-D”,”FOREGROUND”]
[root@docker mywebsite]# ls -l
total 8
-rw-r–r– 1 root root 163 May 19 01:04 Dockerfile
-rw-r–r– 1 root root 38 May 19 01:00 index.html
[root@docker mywebsite]# tar -czf mainfile.tar.gz index.html
[root@docker mywebsite]# ls -l
total 12
-rw-r–r– 1 root root 163 May 19 01:04 Dockerfile
-rw-r–r– 1 root root 38 May 19 01:00 index.html
-rw-r–r– 1 root root 151 May 19 01:05 mainfile.tar.gz

[root@docker mywebsite]# docker build -t myweb .
Sending build context to Docker daemon 4.096 kB
Step 1 : FROM centos:6
Trying to pull repository docker.io/library/centos …
6: Pulling from docker.io/library/centos

7b52546cd236: Pull complete
Digest: sha256:aca5664a09ddb2b14e0697241cb39f52cf5e7820764b7cce4519d185a40f0e29
—> c1bc39e37fd0
Step 2 : MAINTAINER rafi494
—> Running in 2f41df7de59a
—> a23e2ec75f2e
Removing intermediate container 2f41df7de59a
Step 3 : RUN yum install httpd elinks -y
—> Running in e99566bb8dd3
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package elinks.x86_64 0:0.12-0.21.pre5.el6_3 will be installed
–> Processing Dependency: libnss_compat_ossl.so.0()(64bit) for package: elinks-0.12-0.21.pre5.el6_3.x86_64
—> Package httpd.x86_64 0:2.2.15-59.el6.centos will be installed
–> Processing Dependency: httpd-tools = 2.2.15-59.el6.centos for package: httpd-2.2.15-59.el6.centos.x86_64
–> Processing Dependency: system-logos >= 7.92.1-1 for package: httpd-2.2.15-59.el6.centos.x86_64
–> Processing Dependency: initscripts >= 8.36 for package: httpd-2.2.15-59.el6.centos.x86_64
–> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-59.el6.centos.x86_64
–> Processing Dependency: /etc/mime.types for package: httpd-2.2.15-59.el6.centos.x86_64
–> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-59.el6.centos.x86_64
–> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-59.el6.centos.x86_64
–> Running transaction check
—> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed
—> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed
—> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed
—> Package httpd-tools.x86_64 0:2.2.15-59.el6.centos will be installed
—> Package initscripts.x86_64 0:9.03.58-1.el6.centos will be installed
–> Processing Dependency: util-linux-ng >= 2.16 for package: initscripts-9.03.58-1.el6.centos.x86_64
–> Processing Dependency: udev >= 125-1 for package: initscripts-9.03.58-1.el6.centos.x86_64
–> Processing Dependency: sysvinit-tools >= 2.87-6 for package: initscripts-9.03.58-1.el6.centos.x86_64
–> Processing Dependency: plymouth for package: initscripts-9.03.58-1.el6.centos.x86_64
–> Processing Dependency: /sbin/pidof for package: initscripts-9.03.58-1.el6.centos.x86_64
–> Processing Dependency: /sbin/ip for package: initscripts-9.03.58-1.el6.centos.x86_64
–> Processing Dependency: /sbin/blkid for package: initscripts-9.03.58-1.el6.centos.x86_64
–> Processing Dependency: /sbin/arping for package: initscripts-9.03.58-1.el6.centos.x86_64
—> Package mailcap.noarch 0:2.1.31-2.el6 will be installed
—> Package nss_compat_ossl.x86_64 0:0.9.6-2.el6_7 will be installed
—> Package redhat-logos.noarch 0:60.0.14-12.el6.centos will be installed
–> Running transaction check
—> Package iproute.x86_64 0:2.6.32-54.el6 will be installed
–> Processing Dependency: iptables >= 1.4.5 for package: iproute-2.6.32-54.el6.x86_64
–> Processing Dependency: libxtables.so.4()(64bit) for package: iproute-2.6.32-54.el6.x86_64
—> Package iputils.x86_64 0:20071127-24.el6 will be installed
—> Package plymouth.x86_64 0:0.8.3-29.el6.centos will be installed
–> Processing Dependency: libdrm_radeon.so.1()(64bit) for package: plymouth-0.8.3-29.el6.centos.x86_64
–> Processing Dependency: libdrm_nouveau.so.1()(64bit) for package: plymouth-0.8.3-29.el6.centos.x86_64
–> Processing Dependency: libdrm_intel.so.1()(64bit) for package: plymouth-0.8.3-29.el6.centos.x86_64
–> Processing Dependency: libdrm.so.2()(64bit) for package: plymouth-0.8.3-29.el6.centos.x86_64
—> Package sysvinit-tools.x86_64 0:2.87-6.dsf.el6 will be installed
—> Package udev.x86_64 0:147-2.73.el6_8.2 will be installed
–> Processing Dependency: hwdata for package: udev-147-2.73.el6_8.2.x86_64
—> Package util-linux-ng.x86_64 0:2.17.2-12.28.el6 will be installed
–> Running transaction check
—> Package hwdata.noarch 0:0.233-18.1.el6 will be installed
—> Package iptables.x86_64 0:1.4.7-16.el6 will be installed
–> Processing Dependency: policycoreutils for package: iptables-1.4.7-16.el6.x86_64
—> Package libdrm.x86_64 0:2.4.65-2.el6 will be installed
–> Processing Dependency: libpciaccess.so.0()(64bit) for package: libdrm-2.4.65-2.el6.x86_64
–> Running transaction check
—> Package libpciaccess.x86_64 0:0.13.4-1.el6 will be installed
—> Package policycoreutils.x86_64 0:2.0.83-30.1.el6_8 will be installed
–> Processing Dependency: libdbus-glib-1.so.2()(64bit) for package: policycoreutils-2.0.83-30.1.el6_8.x86_64
–> Running transaction check
—> Package dbus-glib.x86_64 0:0.86-6.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
elinks x86_64 0.12-0.21.pre5.el6_3 base 838 k
httpd x86_64 2.2.15-59.el6.centos base 834 k
Installing for dependencies:
apr x86_64 1.3.9-5.el6_2 base 123 k
apr-util x86_64 1.3.9-3.el6_0.1 base 87 k
apr-util-ldap x86_64 1.3.9-3.el6_0.1 base 15 k
dbus-glib x86_64 0.86-6.el6 base 170 k
httpd-tools x86_64 2.2.15-59.el6.centos base 79 k
hwdata noarch 0.233-18.1.el6 base 1.3 M
initscripts x86_64 9.03.58-1.el6.centos base 949 k
iproute x86_64 2.6.32-54.el6 base 389 k
iptables x86_64 1.4.7-16.el6 base 254 k
iputils x86_64 20071127-24.el6 base 121 k
libdrm x86_64 2.4.65-2.el6 base 136 k
libpciaccess x86_64 0.13.4-1.el6 base 24 k
mailcap noarch 2.1.31-2.el6 base 27 k
nss_compat_ossl x86_64 0.9.6-2.el6_7 base 34 k
plymouth x86_64 0.8.3-29.el6.centos base 89 k
policycoreutils x86_64 2.0.83-30.1.el6_8 base 663 k
redhat-logos noarch 60.0.14-12.el6.centos base 15 M
sysvinit-tools x86_64 2.87-6.dsf.el6 base 60 k
udev x86_64 147-2.73.el6_8.2 base 358 k
util-linux-ng x86_64 2.17.2-12.28.el6 base 1.6 M

Transaction Summary
================================================================================
Install 22 Package(s)

Total download size: 23 M
Installed size: 46 M
Downloading Packages:
——————————————————————————–
Total 1.3 MB/s | 23 MB 00:16
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-9.el6.12.3.x86_64 (@CentOS/6.9)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : apr-1.3.9-5.el6_2.x86_64 1/22
Installing : apr-util-1.3.9-3.el6_0.1.x86_64 2/22
Installing : redhat-logos-60.0.14-12.el6.centos.noarch 3/22
Installing : sysvinit-tools-2.87-6.dsf.el6.x86_64 4/22
Installing : hwdata-0.233-18.1.el6.noarch 5/22
Installing : libpciaccess-0.13.4-1.el6.x86_64 6/22
Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 7/22
Installing : httpd-tools-2.2.15-59.el6.centos.x86_64 8/22
Installing : mailcap-2.1.31-2.el6.noarch 9/22
Installing : nss_compat_ossl-0.9.6-2.el6_7.x86_64 10/22
Installing : dbus-glib-0.86-6.el6.x86_64 11/22
Installing : policycoreutils-2.0.83-30.1.el6_8.x86_64 12/22
Installing : iptables-1.4.7-16.el6.x86_64 13/22
Installing : iproute-2.6.32-54.el6.x86_64 14/22
Installing : libdrm-2.4.65-2.el6.x86_64 15/22
Installing : iputils-20071127-24.el6.x86_64 16/22
Installing : plymouth-0.8.3-29.el6.centos.x86_64 17/22
Installing : util-linux-ng-2.17.2-12.28.el6.x86_64 18/22
install-info: No such file or directory for /usr/share/info/ipc.info
Installing : initscripts-9.03.58-1.el6.centos.x86_64 19/22
Installing : udev-147-2.73.el6_8.2.x86_64 20/22
Installing : httpd-2.2.15-59.el6.centos.x86_64 21/22
Installing : elinks-0.12-0.21.pre5.el6_3.x86_64 22/22
Verifying : udev-147-2.73.el6_8.2.x86_64 1/22
Verifying : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 2/22
Verifying : libpciaccess-0.13.4-1.el6.x86_64 3/22
Verifying : elinks-0.12-0.21.pre5.el6_3.x86_64 4/22
Verifying : plymouth-0.8.3-29.el6.centos.x86_64 5/22
Verifying : hwdata-0.233-18.1.el6.noarch 6/22
Verifying : httpd-tools-2.2.15-59.el6.centos.x86_64 7/22
Verifying : sysvinit-tools-2.87-6.dsf.el6.x86_64 8/22
Verifying : iproute-2.6.32-54.el6.x86_64 9/22
Verifying : dbus-glib-0.86-6.el6.x86_64 10/22
Verifying : apr-util-1.3.9-3.el6_0.1.x86_64 11/22
Verifying : nss_compat_ossl-0.9.6-2.el6_7.x86_64 12/22
Verifying : util-linux-ng-2.17.2-12.28.el6.x86_64 13/22
Verifying : apr-1.3.9-5.el6_2.x86_64 14/22
Verifying : redhat-logos-60.0.14-12.el6.centos.noarch 15/22
Verifying : iputils-20071127-24.el6.x86_64 16/22
Verifying : initscripts-9.03.58-1.el6.centos.x86_64 17/22
Verifying : mailcap-2.1.31-2.el6.noarch 18/22
Verifying : libdrm-2.4.65-2.el6.x86_64 19/22
Verifying : policycoreutils-2.0.83-30.1.el6_8.x86_64 20/22
Verifying : httpd-2.2.15-59.el6.centos.x86_64 21/22
Verifying : iptables-1.4.7-16.el6.x86_64 22/22

Installed:
elinks.x86_64 0:0.12-0.21.pre5.el6_3 httpd.x86_64 0:2.2.15-59.el6.centos

Dependency Installed:
apr.x86_64 0:1.3.9-5.el6_2
apr-util.x86_64 0:1.3.9-3.el6_0.1
apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1
dbus-glib.x86_64 0:0.86-6.el6
httpd-tools.x86_64 0:2.2.15-59.el6.centos
hwdata.noarch 0:0.233-18.1.el6
initscripts.x86_64 0:9.03.58-1.el6.centos
iproute.x86_64 0:2.6.32-54.el6
iptables.x86_64 0:1.4.7-16.el6
iputils.x86_64 0:20071127-24.el6
libdrm.x86_64 0:2.4.65-2.el6
libpciaccess.x86_64 0:0.13.4-1.el6
mailcap.noarch 0:2.1.31-2.el6
nss_compat_ossl.x86_64 0:0.9.6-2.el6_7
plymouth.x86_64 0:0.8.3-29.el6.centos
policycoreutils.x86_64 0:2.0.83-30.1.el6_8
redhat-logos.noarch 0:60.0.14-12.el6.centos
sysvinit-tools.x86_64 0:2.87-6.dsf.el6
udev.x86_64 0:147-2.73.el6_8.2
util-linux-ng.x86_64 0:2.17.2-12.28.el6

Complete!
—> 2e0652a2cfbb
Removing intermediate container e99566bb8dd3
Step 4 : ADD mainfile.tar.gz /var/www/html
—> b9efb1646b38
Removing intermediate container c204d3e7d0ac
Step 5 : EXPOSE 80
—> Running in 3a39f8355bf6
—> aaec550a01cd
Removing intermediate container 3a39f8355bf6
Step 6 : ENTRYPOINT /usr/sbin/httpd -D FOREGROUND
—> Running in 0818071b47c6
—> 9448ddb35bcd
Removing intermediate container 0818071b47c6
Successfully built 9448ddb35bcd

[root@docker mywebsite]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
myweb latest 9448ddb35bcd 14 seconds ago 289.1 MB

[root@docker mywebsite]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

[root@docker mywebsite]# docker run -idt myweb
256b65ef9bdc96037ce1d0d7ecb3011c9bc3f6cc5d2f5e58119643c897083f0c

[root@docker mywebsite]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
256b65ef9bdc myweb “/usr/sbin/httpd -D F” 46 seconds ago Up 45 seconds 80/tcp angry_bassi

[root@docker mywebsite]# docker inspect angry_bassi |grep -i ipaddress
“SecondaryIPAddresses”: null,
“IPAddress”: “172.17.0.2”,
“IPAddress”: “172.17.0.2”,

[root@docker mywebsite]# elinks http://172.17.0.2

conatiner1.png

Manage the Lifecycle of an Image from Creation to Deletion

https://docs.docker.com/engine/reference/commandline/ps/

[root@docker mywebsite]# docker rm `docker ps –no-trunc -aq`
.
f2fbf2a02ed2c115bb6330a7b145c26229d52c2ecdc87a5763b110bb2fd1de0d
Error response from daemon: You cannot remove a running container 256b65ef9bdc96037ce1d0d7ecb3011c9bc3f6cc5d2f5e58119643c897083f0c. Stop the container before attempting removal or use -f

[root@docker mywebsite]# docker stop 256b65ef9bdc96037ce1d0d7ecb3011c9bc3f6cc5d2f5e58119643c897083f0c
256b65ef9bdc96037ce1d0d7ecb3011c9bc3f6cc5d2f5e58119643c897083f0c
[root@docker mywebsite]# docker rm `docker ps –no-trunc -aq`
256b65ef9bdc96037ce1d0d7ecb3011c9bc3f6cc5d2f5e58119643c897083f0c

[root@docker mywebsite]# docker rmi $(docker images -q)
Untagged: myweb:latest
Deleted: sha256:9448ddb35bcdddbcab5aa1fed596b4fb890dd9a7205305a8887b23d4341a2186
Deleted:

1) Which is the invalid image tag?
myrepo:version1:otherversion/ubuntu

Further Reading
https://docs.docker.com/engine/reference/commandline/tag/

2) Which of the following pushes an image with the tag myrepo/ubuntu to the repository myrepo using the port 5000?
docker push myrepo:5000/ubuntu

Further Reading
https://docs.docker.com/engine/reference/commandline/tag/

3) Which of the following make sense from an application work flow viewpoint?
Image is built, Image is tagged, Image is pushed to registry.

4) Select all of the following that can be used to secure communications to/from a repository.
basic auth, TLS
Explanation
Basic auth and TLS can be used to secure a private repository. TSL and Quantum entanglement are not currently available for docker.

5) Can a private repository be secured?
True
https://docs.docker.com/docker-hub/repos/

6) Which of the following tags the image to be myrepo/ubuntu?
docker tag myrepo/ubuntu

Further Reading
https://docs.docker.com/engine/reference/commandline/tag/

########################################################

Understand Private Registry Security

[root@ansible ~]# mkdir certs

[root@ansible ~]# yum install openssl -y

[root@ansible ~]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt
Generating a 4096 bit RSA private key
…………………..++
…………………………………………………………………………………………………………………………++
writing new private key to ‘certs/domain.key’
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:linuxfresher
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server’s hostname) []:ansible
Email Address []:

[root@ansible ~]# ls -l certs/
total 8
-rw-r–r– 1 root root 1944 May 18 19:10 domain.crt
-rw-r–r– 1 root root 3272 May 18 19:10 domain.key
[root@ansible ~]# docker run -d -p 5000:5000 –restart=always –name registry -v `pwd`/certs:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key registry:2
f9cb7c46a8acef44b29d299e8a43e466b0f9102bc7722c3df5e84052ca290755

[root@ansible ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f9cb7c46a8ac registry:2 “/entrypoint.sh /etc/” 19 seconds ago Up 16 seconds 0.0.0.0:5000->5000/tcp registry

[root@ansible ~]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos …
latest: Pulling from docker.io/library/centos

Digest: sha256:bba1de7c9d900a898e3cadbae040dfe8a633c06bc104a0df76ae24483e03c077

[root@ansible ~]# docker tag centos ansible:5000/centos
[root@ansible ~]# docker push ansible:5000/centos
The push refers to a repository [ansible:5000/centos]
Get https://ansible:5000/v1/_ping: x509: certificate signed by unknown authority

[root@ansible ~]# mkdir -p /etc/docker/certs.d/ansible:5000

[root@ansible ~]# cp certs/domain.crt /etc/docker/certs.d/ansible\:5000/ca.crt
[root@ansible ~]# docker push ansible:5000/centos

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s