Docker on RHEL

Steps to start Dockerised application on x86.

1. Install Docker

yum install docker

2. Start & Enable service

systemctl start docker.service

systemctl enable docker.service

systemctl status docker.service

[root@xkvm ~]# systemctl status docker.service
docker.service – Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
Active: active (running) since Fri 2014-11-21 07:20:23 EST; 1 weeks 4 days ago
Docs: http://docs.docker.io
Main PID: 26839 (docker)
CGroup: /system.slice/docker.service
└─26839 /usr/bin/docker -d –selinux-enabled -H fd://

3. Docker CLi commands.

[root@xkvm ~]# docker

4. For ex:

Steps to start Dockerised application on x86.

1. Install Docker

yum install docker

2. Start & Enable service

systemctl start docker.service

systemctl enable docker.service

systemctl status docker.service

[root@xkvm ~]# systemctl status docker.service
docker.service – Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
Active: active (running) since Fri 2014-11-21 07:20:23 EST; 1 weeks 4 days ago
Docs: http://docs.docker.io
Main PID: 26839 (docker)
CGroup: /system.slice/docker.service
└─26839 /usr/bin/docker -d –selinux-enabled -H fd://

3. Docker CLi commands.

[root@xkvm ~]# docker

4. For ex: version

[root@xkvm ~]# docker version
Client version: 1.2.0
Client API version: 1.14
Go version (client): go1.3.1
Git commit (client): 2a2f26c/1.2.0
OS/Arch (client): linux/amd64
Server version: 1.2.0
Server API version: 1.14
Go version (server): go1.3.1
Git commit (server): 2a2f26c/1.2.0
[root@xkvm ~]#

5. Work with Docker images

[root@xkvm ~]# docker search –stars=1 –trusted fedora
Warning: ‘–trusted’ is deprecated, it will be removed soon. See usage.
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
fedora/apache 28 [OK]
fedora/couchdb 23 [OK]
fedora/mariadb 22 [OK]
fedora/redis 19 [OK]
fedora/memcached 19 [OK]
fedora/qpid 18 [OK]
fedora/python 18 [OK]
fedora/registry 18 [OK]
fedora/systemd-systemd 18 [OK]
fedora/rabbitmq 18 [OK]
fedora/nginx 18 [OK]
fedora/earthquake 17 [OK]
fedora/firefox 16 [OK]
fedora/ssh 16 [OK]
fedora/nodejs 14 [OK]
fedora/systemd-apache 5 [OK]
tutum/fedora Fedora image with SSH access. For the root… 4 [OK]
vbatts/fedora-varnish https://github.com/vbatts/laughing-octo/tr… 2 [OK]
tutum/fedora-20 DEPRECATED. Use tutum/fedora:20 or tutum/f… 2 [OK]
neroinc/fedora-apache-php-phalcon1.2 Apache, PHP and the Phalcon PHP Framework … 1 [OK]
neroinc/fedora-apache Plain and simple image with Apache httpd b… 1 [OK]
kumarpraveen/fedora-sshd Fedora docker file for ssh service which m… 1 [OK]
openshift/fedora-redis 1 [OK]
fedora/owncloud 1 [OK]
neroinc/fedora-apache-php-phalcon Apache, PHP and the Phalcon PHP Framework … 1 [OK]
jervine/docker-squid Fedora based Squid Proxy 1 [OK]
adelton/freeipa-client Fedora/CentOS container to be used for IPA… 1 [OK]
jervine/docker-sickbeard Fedora 20 based SickBeard 1 [OK]
jervine/docker-sabnzbd Fedora 20 based SABnzbd 1 [OK]
jervine/docker-couchpotato Fedora 20 based CouchPotato 1 [OK]
startx/fedora 1 [OK]
neroinc/fedora-memcached Installation of memcached based on fedora:20 1 [OK]
neroinc/fedora-apache-php Apache and PHP based on fedora:20 1 [OK]
neroinc/fedora-golang 1 [OK]
knighcl/freeipa-devel-rpms FreeIPA project build rpms from any git br… 1 [OK]
juhp/fedora-haskell-ghc Fedora Haskell image 1 [OK]
michilu/fedora-zero 120MB minimum rawhide not install anything 1 [OK]
neroinc/fedora-node Node.js image based on fedora:20 1 [OK]
[root@xkvm ~]#

6. search for images

docker search name

7. Pull images from repo

pulling redis image from fedora repo.

[root@xkvm ~]# docker pull fedora/redis
Pulling repository fedora/redis
178a540d524c: Download complete
511136ea3c5a: Download complete
ff75b0852d47: Download complete
0dae8c30a0b2: Download complete
473b7396e1fb: Download complete
6f809bf47415: Download complete
1a42431fcb9e: Download complete
dfd2e7366898: Download complete
[root@rhevb ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
fedora/redis latest 178a540d524c 9 weeks ago 552.2 MB
[root@xkvm ~]#

8. List Images

[root@xkvm ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
fedora/redis latest 178a540d524c 9 weeks ago 552.2 MB
[root@xkvm ~]#

9. sharing images

docker push <repo/name>

10. Play with containers

[root@xkvm ~]# docker run –name=redis1 redis
Unable to find image ‘redis’ locally
Pulling repository redis
dad71287aacb: Download complete
511136ea3c5a: Download complete
f10807909bc5: Download complete
f6fab3b798be: Download complete
1e6ac0ffed3b: Download complete
62ff5003ac9a: Download complete
e49d349e8a75: Download complete
61213f5a1710: Download complete
1224a21102d6: Download complete
c6e112c19412: Download complete
7d2c1e0aecf8: Download complete
ff39eeaeb65a: Download complete
2854f8d9f233: Download complete
a7f162e686d8: Download complete
1a4e6a91ed17: Download complete
c1f74633a2f9: Download complete
41b458fa48f0: Download complete
15c3639f2b59: Download complete
[1] 02 Dec 17:35:04.183 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
_._
_.-“__ ”-._
_.-“    `.  `_.  ”-._           Redis 2.8.17 (00000000/0) 64 bit
.-“ .-“`.  “`\/    _.,_ ”-._
(    ‘      ,       .-`  | `,    )     Running in stand alone mode
|`-._`-…-` __…-.“-._|’` _.-‘|     Port: 6379
|    `-._   `._    /     _.-‘    |     PID: 1
`-._    `-._  `-./  _.-‘    _.-‘
|`-._`-._    `-.__.-‘    _.-‘_.-‘|
|    `-._`-._        _.-‘_.-‘    |           http://redis.io
`-._    `-._`-.__.-‘_.-‘    _.-‘
|`-._`-._    `-.__.-‘    _.-‘_.-‘|
|    `-._`-._        _.-‘_.-‘    |
`-._    `-._`-.__.-‘_.-‘    _.-‘
`-._    `-.__.-‘    _.-‘
`-._        _.-‘
`-.__.-‘

[1] 02 Dec 17:35:04.185 # Server started, Redis version 2.8.17
[1] 02 Dec 17:35:04.185 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
[1] 02 Dec 17:35:04.185 * The server is now ready to accept connections on port 6379

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s