What is Docker?
Why do we need Docker?
What can it do?
How is Docker different from a virtual machine?
What are images?
What are containers?
How are images related to containers?
What is Docker Hub?
What is a dockerfile?
What are some basic Docker commands?
From docker.com:
"In 2013, Docker introduced what would become the industry standard for containers. Containers are a standardized unit of software that allows developers to isolate their app from its environment, solving the “it works on my machine” headache. For millions of developers today, Docker is the de facto standard to build and share containerized apps - from desktop, to the cloud."
From docker.com:
"In 2013, Docker introduced what would become the industry standard for containers. Containers are a standardized unit of software that allows developers to isolate their app from its environment, solving the “it works on my machine” headache. For millions of developers today, Docker is the de facto standard to build and share containerized apps - from desktop, to the cloud."
From freecodecamp.org:
There are many good things about Docker. It packs, ships, and runs applications as a lightweight, portable, and self-sufficient containerization tool. ... When you are working on a piece of code in a small team, it eliminates the “but it works on my machine” problem.
From docker.com:
"In 2013, Docker introduced what would become the industry standard for containers. Containers are a standardized unit of software that allows developers to isolate their app from its environment, solving the “it works on my machine” headache. For millions of developers today, Docker is the de facto standard to build and share containerized apps - from desktop, to the cloud."
From freecodecamp.org:
There are many good things about Docker. It packs, ships, and runs applications as a lightweight, portable, and self-sufficient containerization tool. ... When you are working on a piece of code in a small team, it eliminates the “but it works on my machine” problem.
The problem:
A developer creates a product and sends instructions to team members on how to run it. Some team members can't run it, because their machine requires installation of additional software. Others can't run it because they were on a different operating sytem.
The problem:
A developer creates a product and sends instructions to team members on how to run it. Some team members can't run it, because their machine requires installation of additional software. Others can't run it because they were on a different operating sytem.
The problem:
A developer creates a product and sends instructions to team members on how to run it. Some team members can't run it, because their machine requires installation of additional software. Others can't run it because they were on a different operating sytem.
Example Atlantis Ecosystem model
Containerize the problem
Create product in a container. Include all required dependencies in the container.
These containers can be run on any physical machine, virtual machine and on the cloud.
Containerize the problem
Create product in a container. Include all required dependencies in the container.
These containers can be run on any physical machine, virtual machine and on the cloud.
So how are containers made?
Containerize the problem
Create product in a container. Include all required dependencies in the container.
These containers can be run on any physical machine, virtual machine and on the cloud.
So how are containers made?
Dockerfile
(a text file containing commands to assemble an image
) is created.docker build
to create an image
from the Dockerfile
docker run
to create a run time instance of the image
called a container
containers
?containers
?Containers are isolated environments.
Like a virtual machine but lightweight, they are smaller in size (MB rather than GB), they boot up faster (seconds rather that minutes, example Travis CI).
containers
?Containers are isolated environments.
Like a virtual machine but lightweight, they are smaller in size (MB rather than GB), they boot up faster (seconds rather that minutes, example Travis CI).
Differences between a VM and a docker image:
container
exampleExample: Linux has many flavors (distibutions) of OS:
The main difference is the software included in the distribution
Say you develop on one distribution there is no guarentee it will run on another. However with docker you can create a container which includes a specific distribution to run your application. Anyone can run that container on any of their distributions. Since everything needed to run it are contained within the container. The container is it's own isolated environment.
images
+ Docker HubThis is where things can get a little confusing.
images
+ Docker HubThis is where things can get a little confusing.
image
is a template that contains a set of instructions for creating a container
that runs on the Docker platform.images
+ Docker HubThis is where things can get a little confusing.
A Docker image
is a template that contains a set of instructions for creating a container
that runs on the Docker platform.
Specifically, when the docker run
command is used, an instance of the image
is created. This instance is called a container
. Multiple instances of the same image can be run at the same time since each container is an isolated environment.
images
+ Docker HubThis is where things can get a little confusing.
A Docker image
is a template that contains a set of instructions for creating a container
that runs on the Docker platform.
Specifically, when the docker run
command is used, an instance of the image
is created. This instance is called a container
. Multiple instances of the same image can be run at the same time since each container is an isolated environment.
A Container lives only as long as the processes inside it are running. Containers are ephemeral
images
+ Docker HubThis is where things can get a little confusing.
A Docker image
is a template that contains a set of instructions for creating a container
that runs on the Docker platform.
Specifically, when the docker run
command is used, an instance of the image
is created. This instance is called a container
. Multiple instances of the same image can be run at the same time since each container is an isolated environment.
A Container lives only as long as the processes inside it are running. Containers are ephemeral
Docker Hub is a public repository (like GitHub) for storing images. These images can easily be downloaded (pulled) using the docker pull
command.
User created images can then be pushed to Docker Hub for others to pull.
images
There are a collection of Docker images (by some of the ropensci folks) that include R related products. They can be found on docker hub @ https://hub.docker.com/u/rocker with source code info on GitHub @ https://github.com/rocker-org
images
There are a collection of Docker images (by some of the ropensci folks) that include R related products. They can be found on docker hub @ https://hub.docker.com/u/rocker with source code info on GitHub @ https://github.com/rocker-org
RStudio image - allows you to create an RStudio instance (using any version of R) without having to install RStudio or a specific verison of R on your local machine (https://hub.docker.com/r/rocker/rstudio)
images
There are a collection of Docker images (by some of the ropensci folks) that include R related products. They can be found on docker hub @ https://hub.docker.com/u/rocker with source code info on GitHub @ https://github.com/rocker-org
RStudio image - allows you to create an RStudio instance (using any version of R) without having to install RStudio or a specific verison of R on your local machine (https://hub.docker.com/r/rocker/rstudio)
RStudio image with tidyverse and publishing packages
images
There are a collection of Docker images (by some of the ropensci folks) that include R related products. They can be found on docker hub @ https://hub.docker.com/u/rocker with source code info on GitHub @ https://github.com/rocker-org
RStudio image - allows you to create an RStudio instance (using any version of R) without having to install RStudio or a specific verison of R on your local machine (https://hub.docker.com/r/rocker/rstudio)
RStudio image with tidyverse and publishing packages
Shiny server image
Windows machine: docker runs under elevated access so you need permission every time you launch docker on your local machine. Not really a viable option for a government computer. Home use will be fine.
Linux/mac: Good to go (Not aware of any problems)
Windows machine: docker runs under elevated access so you need permission every time you launch docker on your local machine. Not really a viable option for a government computer. Home use will be fine.
Linux/mac: Good to go (Not aware of any problems)
Internal server: docker is installed on an internal server (mars) at NEFSC so anyone can use it. You just need to be added to the user group
Windows machine: docker runs under elevated access so you need permission every time you launch docker on your local machine. Not really a viable option for a government computer. Home use will be fine.
Linux/mac: Good to go (Not aware of any problems)
Internal server: docker is installed on an internal server (mars) at NEFSC so anyone can use it. You just need to be added to the user group
Let's try this out.
Windows machine: docker runs under elevated access so you need permission every time you launch docker on your local machine. Not really a viable option for a government computer. Home use will be fine.
Linux/mac: Good to go (Not aware of any problems)
Internal server: docker is installed on an internal server (mars) at NEFSC so anyone can use it. You just need to be added to the user group
Let's try this out.
Thanks to ITD:
Specification of an image are stored in a Dockerfile
. This is just a set of instruction on what to include in the image and how to build the image.
Specification of an image are stored in a Dockerfile
. This is just a set of instruction on what to include in the image and how to build the image.
Sample Atlantis dockerfile
FROM debian:jessieRUN apt-get update && apt-get install -yq build-essential autoconf libnetcdf-dev libxml2-dev libproj-dev subversion valgrind dos2unix nanoCOPY .svn /app/.svnCOPY atlantis /app/atlantisRUN cd /app/atlantis && aclocal && autoheader && autoconf && automake -a && ./configure && make && make installWORKDIR /app/modelCMD ./RunAtlantis.sh
Specification of an image are stored in a Dockerfile
. This is just a set of instruction on what to include in the image and how to build the image.
Sample Atlantis dockerfile
FROM debian:jessieRUN apt-get update && apt-get install -yq build-essential autoconf libnetcdf-dev libxml2-dev libproj-dev subversion valgrind dos2unix nanoCOPY .svn /app/.svnCOPY atlantis /app/atlantisRUN cd /app/atlantis && aclocal && autoheader && autoconf && automake -a && ./configure && make && make installWORKDIR /app/modelCMD ./RunAtlantis.sh
This Dockerfile
is built into an image called atlantis
with a tag of 6420
indicating the version of the Atlantis code being used.
docker build -t atlantis:6420
docker images
- lists images
docker pull <image name>
- pull image from Docker Hub but doesn't run it
docker run <image name>
- run container from an image. Will pull image if can't find locally
docker run -d <image name>
- runs container in background.
docker run <containername>:<tag id>
- run a container with a tag
docker ps
- lists all running containers
docker ps -a
- lists all running or exited containers
docker stop <container ID>
- stops container from running
docker rm <container ID>
- remove stopped or exited container
docker rmi <image name>
- remove image . must reomove all running containers based off image first
ctrl+C - exits running container
Docker manual Official site documentation
Docker Tutorial for beginners Video (2h 10m)
Docker Course Interactive hands on course. Free
7 Cases when not to use docker Article
r-docker tutorial. A little less techy
Docker Hub. Repository for Docker images
rocker All R related Docker images on Docker Hub by ropensci
rocker.org on GitHub Code behind the images on Docker Hub
What is Docker?
Why do we need Docker?
What can it do?
How is Docker different from a virtual machine?
What are images?
What are containers?
How are images related to containers?
What is Docker Hub?
What is a dockerfile?
What are some basic Docker commands?
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |