cd /etc/init vim docker.conf
replace /usr/bin/docker -d
with this /usr/bin/docker -H 0.0.0.0:5555 -d
so that we can connect through http api.
alias docker="docker -H 0.0.0.0:5555"
cd /var/lib/docker/containers
in the above locations you can find all the containers which are all executed
Life cycle of containers and images
pull the base image from docker repo
docker pull ubuntu
docker run -t -i ubuntu /bin/bash
apt-get install -y ping
exit
whenever you run a container , all the changes are persisted.
to reuse the same container with the changes you have done previously you can commit it. to commit the container we need to find the container id
docker ps -a
find the last executed one. the one which has less created time .
ex : d1ecf93b16ef
docker commit d1ecf93b16ef
b56fc70d1c09
docker images # will show up your images b56fc70d1c09
docker tag b56fc70d1c09 yuva/gist/latest
docker commit
has some more awesome features
Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY [TAG]]
Create a new image from a container's changes
-author="": Author (eg. "John Hannibal Smith <[email protected]>"
-m="": Commit message
-run="": Config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs": ["22"]}')
working command
docker commit -run='{"Cmd": ["echo", "helloworld"], "PortSpecs": ["80"]}' a551c72e98b4 yuva/apache2 latest
to do a port forward of the container service
docker run -t -i -d -p 1234:80 ubuntu /bin/bash
forward all the packets which are coming to the host machine port 1234 to the 80 port of the container :)
http://www.kstaken.com/blog/2013/07/06/how-to-run-apache-under-docker/
Setting up Internal docker registry server
apt-get install build-essential python-dev libevent-dev python-pip
cd /opt/
git clone https://github.com/dotcloud/docker-registry
pip install -r requirements.txt
apt-get install supervisor
mkdir /var/log/docker-registry/
add the following in /etc/supervisor/supervisord.conf
[program:gunicorn]
command=/usr/local/bin/gunicorn --access-logfile - --debug -k gevent -b 0.0.0.0:5000 -w 1 wsgi:application
directory=/opt/docker-registry
process_name=%(program_name)s
stdout_logfile=/var/log/docker-registry/stdout.log
stderr_logfile=/var/log/docker-registry/stderr.log
autostart=true
redirect_stderr=True
service supervisor stop
service supervisor start
Follow the README https://github.com/dotcloud/docker-registry
sudo docker tag 0u812deadbeef l0.30.0.115:5000/ping
where 0u812deadbeef is the image name Upload to the local index
sudo docker push l0.30.0.115:5000/ping
sudo docker pull l0.30.0.115:5000/ping
###taging
docker tag 6ce36a355ff5 10.30.0.115:5000/ping testtag
docker push 10.30.0.115:5000/ping -t testtag
http://10.30.0.115:5000/v1/repositories/ping/tags
####Reference http://docs.docker.io/en/latest/use/workingwithrepository/#using-private-repositories