2. Docker - Walid Ashraf
Table of Contents
Install Docker on Linux (Ubuntu)
Using Docker
Installing Docker On windows
3. Official Documentation for Ubuntu
https://docs.docker.com/engine/installation/linux/ubuntulinux/
INSTALL DOCKER FOR
UBUNTU
4. Docker - Walid Ashraf
Prerequisites For Installation
Docker Requires 64-bit OS
Docker requires Linux kernel 3.10.0+
An UpdatedVersion of you Package Manager (APT) Lists (Docker List)
AUFS Support
• Installation of Kernel Extra Image (Linux-image-extra-* kernel packages) for Ubuntu
Trusty 14.04, and Xenial 16.04
5. Docker - Walid Ashraf
Installation
sudo apt-get install docker-engine
Start The Docker Service
• sudo service docker start
Test your first container:
sudo docker run hello-world
8. Docker - Walid Ashraf
info, images, ps , pull
docker info
• States current client and daemon versions
docker images
• Lists Current Images at the machines
docker search
• Searches images on default repo
docker pull
• Downloads a image from the default repo.
docker ps
• List all containers at the machine
• -a : List all containers
9. Docker - Walid Ashraf
Run Command
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Set Container Name
• -name value
• Ex: docker run -name test HelloWorld
Start in interactive mode
• -i interactive mode
• -t Open tty
• Ex: docker run -it Ubuntu
Set Working dir
• Ex: docker run -w /home/ -i -t ubuntu pwd
Start in detached Mode
• Ex: docker run -d seqvence/static-site
10. Docker - Walid Ashraf
Run Command (Ports)
Port Mapping
• -p hostPort:ContainerPort
• -p hostIp:hostPort:ContainerPort
• -P all ports
• docker run -P seqvence/static-site
• docker run -d -p 80:80 --name webserver nginx
List Container Port
• docker port CONTAINER
• Ex: docker port webserver
11. Docker - Walid Ashraf
Run Command (Volumes)
Docker Volumes allow a container to mount a directory to be shared between the
host and container(s)
-v hostdirectory:containerdir
containerdi:ro allow that the mounted container to be read only
Ex: docker run -v /home/sharedfoo:/foo -it ubuntu bash
Ex: docker run -v /home/sharedfoo:/foo:ro -it ubuntu bash
12. Docker - Walid Ashraf
Other Import Commands
create
• Creates a docker containers with all options but doesn’t start it
start, pause, stop, rm
stats
• Gives a live preview of container utilization
exec
• Executes a command inside a container
• docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
• Ex: docker exec -d ubuntu_bash touch /tmp/execWorks
cp
• Copies data from container to host and vice versa
• Ex: docker cp container:/file1 /home/
• Ex: docker cp /home/file2 container:/
15. Docker - Walid Ashraf
Using Docker toolbox
Toolbox includes these Docker tools:
• Docker Machine for running docker-machine commands
• Docker Engine for running the docker commands
• Docker Compose for running the docker-compose commands
• Kitematic, the Docker GUI
• a shell preconfigured for a Docker command-line environment
• OracleVirtualBox
Prerequisites
• Docker Tool Box Requires 64 BitWindows 7 or More
• Docker Requires H/WVirtualization ( AVirtual Box Requirement)
InstallTools
16. Docker - Walid Ashraf
Using Terminal
Using Docker quick start terminal to test any docker commands
17. Docker - Walid Ashraf
Using Kitematic
Kitematic is a GUI Docker Controller
You can search for any public images , create and Manager Containers.
Kitematic also automates advanced features such as managing ports and configuring volumes.
You can use Kitematic to change environment variables, stream logs, and single click terminal into your
Docker container all from the GUI.
Checkout
• https://docs.docker.com/kitematic/userguide/
20. Docker - Walid Ashraf
Installation
Prerequisites
Windows runs on 64bit Windows 10 Pro, Enterprise and Education (1511 November update, Build 10586 or
later).
The Hyper-V package must be enabled for Docker for Windows to work
Installation
Open Power shell and Use Docker command line