Sign inSign up

vrbabu/docker_jenkins

By vrbabu

•Updated over 9 years ago

automated test build

Image
0

876

vrbabu/docker_jenkins repository overview

#This Dockerfile can be used to create a jenkins container on a centos host

Creating and exporting containers to another docker engine host.

  1. Install and Configure the necessary packages and services.

  2. Commit the docker container to the repository [root@controlnode jenkins1]# docker commit 0c698d692c2d washingmachine sha256:c5ea8bdf6ce656b007427b6c44b877b9c026f98be0f0df878f146c75b1539931 [root@controlnode jenkins1]#

  3. Verify the changes using docker history command [root@controlnode jenkins1]# docker history washingmachine IMAGE CREATED CREATED BY SIZE COMMENT c5ea8bdf6ce6 15 seconds ago /bin/bash 205.1 MB
    9284f1833085 13 minutes ago /bin/sh -c yum update -y && yum install epel 383.9 MB
    98d35105a391 2 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
    2 weeks ago /bin/sh -c #(nop) LABEL name=CentOS Base Ima 0 B
    2 weeks ago /bin/sh -c #(nop) ADD file:29f66b8b4bafd0f005 192.5 MB
    7 months ago /bin/sh -c #(nop) MAINTAINER https://github⁠. 0 B
    [root@controlnode jenkins1]#

  4. Save the container with name of choice and location with extension as tar using the source container [root@controlnode jenkins1]# docker save -o ../washingmachine.tar washingmachine [root@controlnode jenkins1]# cd .. [root@controlnode ~]# ls anaconda-ks.cfg helloworld jenkins1 washingmachine.tar [root@controlnode ~]# du -sh washingmachine.tar 761M washingmachine.tar [root@controlnode ~]#

  5. scp the .tar container file to remote docker engine host [root@controlnode ~]# scp -r washingmachine.tar [email protected]:/root

  6. On the remote host, list the container tar file, [root@buildserver ~]# tar -tf washingmachine.tar c5ea8bdf6ce656b007427b6c44b877b9c026f98be0f0df878f146c75b1539931.json daf7d2b5ec7511e55005ba39e3b6c2487e6fab928b20e097275c703d8c3f0a24/ daf7d2b5ec7511e55005ba39e3b6c2487e6fab928b20e097275c703d8c3f0a24/VERSION daf7d2b5ec7511e55005ba39e3b6c2487e6fab928b20e097275c703d8c3f0a24/json daf7d2b5ec7511e55005ba39e3b6c2487e6fab928b20e097275c703d8c3f0a24/layer.tar de1fb044ff3813e85282aa5d2da637cd5b2e1e451ed9f804cb50f58a60a5a770/ de1fb044ff3813e85282aa5d2da637cd5b2e1e451ed9f804cb50f58a60a5a770/VERSION de1fb044ff3813e85282aa5d2da637cd5b2e1e451ed9f804cb50f58a60a5a770/json de1fb044ff3813e85282aa5d2da637cd5b2e1e451ed9f804cb50f58a60a5a770/layer.tar ec3eb46e255a820133aeba59006a86a6cd0a156c6aae8f3cfd17c66927de3548/ ec3eb46e255a820133aeba59006a86a6cd0a156c6aae8f3cfd17c66927de3548/VERSION ec3eb46e255a820133aeba59006a86a6cd0a156c6aae8f3cfd17c66927de3548/json ec3eb46e255a820133aeba59006a86a6cd0a156c6aae8f3cfd17c66927de3548/layer.tar manifest.json repositories [root@buildserver ~]#

  7. Load the docker image, [root@buildserver ~]# docker load -i washingmachine.tar 9b198ff9ff5b: Loading layer [==================================================>] 200.1 MB/200.1 MB 5e3b4194d595: Loading layer [==================================================>] 389.6 MB/389.6 MB c9c4b618ceae: Loading layer [==================================================>] 207.7 MB/207.7 MB Loaded image: washingmachine:latest [root@buildserver ~]#

  8. List the docker images, note that docker container listing will be empty (docker ps) [root@buildserver ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [root@buildserver ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE washingmachine latest c5ea8bdf6ce6 8 minutes ago 781.6 MB [root@buildserver ~]#

  9. Start the docker container on required port and try the 'docker ps' image listing [root@buildserver ~]# docker run -it -d -p 8080:8080 --name=jenkinsgit washingmachine 6014414f3ec203153b5ffbf859c38725a08411e66c8e8f54394aa07b194a7868 [root@buildserver ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6014414f3ec2 washingmachine "/bin/bash" 8 seconds ago Up 2 seconds 0.0.0.0:8080->8080/tcp jenkinsgit [root@buildserver ~]#

  10. Attach to the container and start the respective service, [root@buildserver ~]# docker attach 6014414f3ec2 [root@6014414f3ec2 /]# /etc/init.d/jenkins start Starting Jenkins [ OK ] [root@6014414f3ec2 /]#

  11. Verify that the service is running and port is open, and access the service on the browser. [root@buildserver ~]# netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1439/sshd
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2112/master
    tcp6 0 0 :::8080 :::* LISTEN 3712/docker-proxy-c tcp6 0 0 :::22 :::* LISTEN 1439/sshd
    tcp6 0 0 ::1:25 :::* LISTEN 2112/master
    [root@buildserver ~]# #End

Tag summary

Content type

Image

Digest

Size

242.6 MB

Last updated

over 9 years ago

docker pull vrbabu/docker_jenkins