running applications. Is fast, lightweight and portable and you can separate your applications from your infrastructure. Docker combining a lightweight container virtualization platform with workflows and tooling that help you manage and deploy your applications.
For example, an image could contain an Ubuntu operating system with Apache, NGINX or your database. ! Images are used to create Docker containers. ! You can: • build new images • update existing images • download Docker images already created.
! A Docker container holds everything that is needed for an application to run and can be run, started, stopped, moved, and deleted. ! Each container is an isolated and secure application platform. ! A container consists of an operating system, user-added files, and meta-data.
holds, what process to run when the container is launched, and a variety of other configuration data. ! When Docker runs a container from an image, it adds a read-write layer on top of the image (using a union file system) in which your application can then run.
# stop a container docker rm # remove a container docker rmi # remove an image docker inspect # information about container docker commit # create a new image from the container docker logs # container’s logs docker build # build a container from a dockerfile docker ps # lists the container docker pull # pull an image from a registry
# Set environment variables -h # Container host name -p # Publish a container's port to the host -v, --volume= #Bind mount a volume --link #Add link to another container (name:alias) --volumes-from= #Mount volumes from the specified container(s) -m, --memory=”” #Memory limit -c #CPU shares (relative weight)
/var/log/text -v /var/log # mount dir outside container -p 80:80 # redirect 80 port of host machine to 80 port of container --name nginx_c # name this container nginx_c touch /var/log/text # our COMMAND with [ARG]
image RUN apt-get update # run a command RUN apt-get install -y build-essential git python / python-dev python-setuptools python-pip ADD ./ /app # copy files from host machine to images RUN pip install -r /app/requirements.txt VOLUME /app # In this way you can see this dir from your host machine EXPOSE 8080 # Port to expose CMD ["/usr/local/bin/uwsgi" ,"--ini" ,"/app/conf/uwsgi.ini"] # default command that will run when container starts
- PaaS provider for Docker • CoreOS - OS for Docker cloud server • Maestro - Orchestration system for Docker • Apache Mesos - From the name it seems awesome • Flynn.io - PaaS provider for Docker • Deis.io - PaaS provider for Docker • Other - A lot of other interesting stuff
How is Docker.io different from a normal VM ? http://stackoverflow.com/questions/16047306/how-is-docker-io- different-from-a-normal-virtual-machine ! Can you explain Docker with a practical example/case ? http://stackoverflow.com/questions/20618828/can-you-explain-docker- with-a-practical-example-case ! Docker Explained: How To Containerize Python Web Applications https://www.digitalocean.com/community/tutorials/docker-explained-how- to-containerize-python-web-applications ! !