docker tut

docker imp commands 
--------------------

1) docker images 

2) your could also  pull a image and then run it saperately
docker pull centos:centos6        --> centos6 is the tags 

2) docker run docker/ubuntu
or 
2) docker run docker/ubuntu /bin/echo "hello world"
or 
2) docker run -d ubuntu for i  in `cat file`;do echo $i > file ;done 





3) see containers if running 
docker ps -a or docker ps 


4) To createa custom images  

a) mkdir customedocker/ ; cd customedocker

b) vi dockerfile 
FROM ubuntu:latest

RUN apt-get -y update && apt-get install -y vim

CMD ls -al



c) docker build -t dockername1 .

d) docker run dockername1

5) remove containers 
docker rm containerID 
   
   remove images 
docker rmi imageid 


6) running a webserver 

a) docker run -P -d --name web1 nginx 
b) docker port web1
c) docker stop web1
d) docker start  web1
7) running a webserver with custom mount points  

a) cd /var/www ; eccho "hello web" > index.html
b) docker run -P -d  --name web nginx   -v /var/www:/usr/share/nginx/html:ro -v /var/nginx/conf:/etc/nginx:ro



8) how to start a container and jump to command line 
docker run -ti ubuntu /bin/bash


9) start container in background  and run command in loop in container 

docker run -P -d --name web1 nginx /bin/sh -c "while true ; echo \"i am doing \"  ; sleep 1 ;done "

docker logs web1   < --- you will see whats running on the machine 


10) if I need to move back to the one  of the container terminals 

 docker exec -it container-id bash

11 ) after making chnages to a container we need to commit those changes 

docker commit -m "some changes " -a "your user name" container-id aggeorge/nginx.01:v2

docker push aggeorge/nginx.01:v2

12) To see your history of commits 

docker histroy aggeorge/nginx.01


13) set up of a wordpress website x 

a) docker run --name wordpresmyql -e MYSQL_ROOT_PASSWORD=password -d mysql 
b) docler ps -l 
c) docker run -name mywordpress --link wordpresmyql:mysql -P -d wordpress
d) docker port mywordpress or docker ps -l 
e) http://localhost:portnumber



14 ) installing docker compose 

curl -L https://github.com/docker/compose/releases/download/1.7.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

$ chmod +x /usr/local/bin/docker-compose



14) documentatin on docker compose 


15) wordpress installation 












































Other Articles

Enter your email address: