Setting up Docker Private Registry

create a folder which name is docker-private-registry

then install docker compose

pip install docker-compose

then create the docker-compose.yml

image: registry
– STORAGE_PATH=/registry
– registry-stuff:/registry
– “5000:5000”

run the compose file with

docker-compose up

then you will see the blank page when you visit http://localhost:5000

private registry is done but i found the nice ui for registry


How To Dockerize Jenkins

create a sample directory  with mkdir jenkinsci and create a new Dockerfile

cd jenkinsci

touch Dockerfile


FROM jenkins:2.0

USER root
RUN apt-get update \
&& apt-get install -y sudo \
&& rm -rf /var/lib/apt/lists/*
RUN echo “jenkins ALL=NOPASSWD: ALL” >> /etc/sudoers

USER jenkins
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/ /usr/share/jenkins/plugins.txt

then create a plugins.txt file for jenkins plugins


save it then build the jenkins image

sudo docker build -t jenkinsci .

now we must to run container

sudo docker run -d -v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker -p 8080:8080 jenkinsci

by the way we mapped docker socket ,binary  for running docker commands in container

this command will return container job id. Dont clear the console!

when you visit the http://localhost:8080 you will see the jenkins default login screen


you can find the administator password with

docker logs <job_id>


Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:


You can continue the next steps then you will see the Jenkins Home screen, then we must the test docker command with docker-test project

  • Create a Freestyle Project
  • Add shell build step then save it
  • sudo docker run hello-world

  • Run the build and look at the build logs

run the build.


Well, you dockerized jenkins 🙂 awesome!  In next chapter we will integrate jenkins volume



Docker – 07- Container Networking,IPAddress,Port


Docker Container Networking,IPAddress,Port

Firstly we will create the web server

docker run -d –publish-all jpetazzo/web

Ports   -> Port Mapping

:32768-> Host Port Number

:8000-> Containers Port Number

curl localhost:32768

Get the Host Port number by container number

docker port <container_id> 8000

You can assign manually port

docker run -d -p 88:8000 jpetazzo/web

You can get the container  private ip address

docker inspect –format ‘{{.NetworkSettings.IPAdress}}’ <container_id>

Docker – 04- Some Docker Commands


Some Docker Commands

docker ps -q  > running containers

docker ps -a > all containers

docker ps -aq > all containers id

docker rm <container_id> remove the docker container

docker rmi <image_id> remove docker image

docker rmi  -f <image_id> remove docker image force

docker kill <conainer_id> kill the container

docker stop <container_id> stop the process

docker tag <image_id> myimage > give the name of image

docker ps -l > latest created container

docker images > list of images

You can hit the docker you will see all of command  and if you want to see detail the command docker images -help  

Docker – 03- Building Docker Images (Interactively)


We can build docker image with commit

  1. We create container with base ubuntu image

docker run -it ubuntu bash

apt-get install wget

apt-get install curl

docker ps -l

80a2df5a4a68 ubuntu:latest “bash” 4 minutes ago

You must be see created container id  and we can see diff before and last state

docker diff 80a2df5a4a68

We are commit changes to container

docker commit 80a2df5a4a68

And its give to us new container ID


docker run -it 390 bash

And you can check curl and wget theese must be installed to new container

We can set the tag name created image with image id or  we can set when creating

docker commit d09e4ad2912b myimage

docker tag d09e4ad2912b myimage

docker images

You must see

myimage latest d09e4ad2912b 2 minutes ago



Docker – 02- Images and Containers

Docker Images vs Containers



I will describe one sentence by OOP

Images are classes

     >Readonly filesystem

Containers are class instances

>Encapsulated set of process running Read-Write copy of that filesystem(image)

By the way

docker run -> starts a container from given image

 We will describe docker images command (build,commit,import)

Images namespaces

Classes are must be under the namespace so images must be

Root like


User (and organizations)



You can see the list of images by this command

docker images

You can search spesific image by

docker search zookeeper

And you can pull images by

docker pull debian:jessie

docker images

You will show downloaded image