What is docker

Docker allows you to package an application with all of its dependencies into a standardized unit for software development. It is like virtual box or vmware but more flexible and it is lightweight

How to install

Linux: https://docs.docker.com/engine/installation/linux/ubuntulinux/
Windows: https://docs.docker.com/engine/installation/windows/
MacOS: https://docs.docker.com/engine/installation/mac/

Docker main commands

Pulling an image (needs an account in docker hub)
sudo docker pull ubuntu

Starting an image
docker start <containerid>
docker exec -i -t <containerid> /bin/bash to get shell access to this container

Running an image
docker run -i -t -P ubuntu /bin/bash

Docker run will create a new container with new writable layer,
Docker start will start an existing container, and maintains the writable layer.

Installing something in image
docker run ubuntu apt-get install -y apache2

Getting the list of containers
sudo docker ps -l

Commiting the changes
Then get the container id using this command:Commit changes to the container:
docker commit -m “commit message”  <container_id>
docker commit <container_id> iman/ping (the image name)

Running the changed container
docker run -p:8080:8080 -p:8090:8090 -v /Users/kostaskarkaletsis/Desktop/:/kostas -i -t -P karkaletsis/openncp /bin/bash

see opened ports of a container and their mappings
docker port containerid
80/tcp ->
22/tcp ->

Get the address of the default VM
docker-machine ip default

Access remote webserver

http://[ip from previous step]:32768 (just an example)

By admin