Difference between revisions of "Docker"

From MyWiki
Jump to: navigation, search
Line 3: Line 3:
  
 
Reference : https://docs.docker.com/userguide/dockerimages/<br>
 
Reference : https://docs.docker.com/userguide/dockerimages/<br>
 +
https://docs.docker.com/engine/installation/linux/ubuntulinux/  (This is very good ) <br>
  
 
'''Updating and committing an image'''<br>
 
'''Updating and committing an image'''<br>

Revision as of 00:15, 16 February 2016

Installing in ubuntu 14.04 :
wget -qO- https://get.docker.com/ | sh

Reference : https://docs.docker.com/userguide/dockerimages/
https://docs.docker.com/engine/installation/linux/ubuntulinux/ (This is very good )

Updating and committing an image
1. Start the image and note the number :

$ docker run -t -i training/sinatra /bin/bash
root@0b2616b0e5a8:/#

2. Install some software and then exit the container and run the docker commit

$ docker commit -m "Added json gem" -a "Kate Smith" \
0b2616b0e5a8 ouruser/sinatra:v2
4f177bd27a9ff0f6dc2a830403925b5360bfe0b93d476f7fc3231110e7f71b1c


Fedora install
Reference : https://docs.docker.com/engine/installation/linux/fedora/
sudo dnf update

tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/fedora/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF

dnf install docker-engine
systemctl start docker

Working commands to start tomcat in docker and expose ports
[root@sharpner ~]# docker run -d -p 8080:8080 consol/tomcat-6.0

docker ps :
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
27de6a32397b consol/tomcat-6.0 "/bin/sh -c /opt/tomc" 4 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp, 8778/tcp elegant_stallman

Connecting
docker exec -it 27de6a32397b /bin/bash

Export a container :
Reference - http://www.jamescoyle.net/how-to/1512-export-and-import-a-docker-image-between-nodes