Learning docker !!!


To run docker

To see Docker images on system

Writing a Docker File

Build an image from your docker file

Run your new docker-whale

Tag and push the image

Remove Docker Image

Pull your new image

To View List of All Containers

To view list of Latest created containers including non-running containers

To List the networks on docker

To Launch docker into the network by default it will launch in bridge network unless customized otherwise

inspecting the bridge is the easiest way to find containers ip address

To disconnect the container from a network

To create your own bridge network

To add containers to a network

To inspect bridge

To add container to network without specifying network

To get the ip address on which container is deployed

To open a shell to running container

To attach a container to other network


Data Volumes

Adding a data volumn

Location a volumn

Mount a host directory as a data volume

Mount a host directory as data volume with read only

Mount a host file as a data volume¶

** The -v flag can also be used to mount a single file - instead of just directories - from the host machine.

Creating and mounting a data volume container

To mount the /dbdata volume in another container by using –volumes-from flag

To extend chain by mounting the volume that came from the dbstore

Backup, restore or migrate data volumes

To remove volumes

To delete containers

Delete all available containers

To expose default ports

Specify a different post :

Example

Dockerfile example

 FROM justrohu/apache-php5
 MAINTAINER justrohu <justrohu@gmail.com>
 COPY 000-default.conf /etc/apache2/sites-available/000-default.conf  
 [ overridding container httpd.conf with host conf ]

 EXPOSE 80    # exposing http port
 EXPOSE 443   # exposing https port

  # CMD ["executable","param1","param2"] { syntax on command writting }

 CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

 RUN apt-get update && \ apt-get install nodejs && \ apt-get install npm

 ENV MYSQL_ROOT_PASSWORD=root
 ENV MYSQL_ROOT_USER=root

To Stop a running container