Creating and Running Docker Containers¶
This is a short introduction to building a Docker container. Containers are a starting point for applications within the CyVerse Discovery Environment, including VICE applications (See: VICE documentation), or for applications you may wish to deploy on Atmosphere. We will cover 1) setting up your computer for Docker, 2) pulling and running a container from Docker Hub, and 3) creating a Dockerfile.
Downloads, access, and services¶
In order to complete this tutorial you will need access to the following services/software
Prerequisite Preparation/Notes Link/Download Docker You will need Docker CE installed on your machine complete this exercise Docker Setup Docker Hub account You will need a Docker Hub account to complete this exercise Docker Hub CyVerse account An account is not required but encouraged CyVerse User Portal Atmosphere access An account is not required unless you wish to complete exercises using a CyVerse virtual machine (Atmosphere) Atmosphere Manual An active Atmosphere instance running Ubuntu An account is not required unless you wish to complete exercises using a CyVerse virtual machine (Atmosphere) Ubuntu 18_04 GUI XFCE Base v2.0
Setting up Docker on your computer¶
To get started, we need to install the “Docker daemon” - this is the software which will allow us to run Docker containers. It is usually easily installed, but since instructions may change we suggest you visit the Docker Setup website. For more background about what Docker is, please see the Docker get started website.
If you are going to run Docker on your Mac/PC/Linux computer
- Follow the instructions to install Docker: Docker Setup
If you are going to run Docker on your on a CyVerse Atmosphere machine
- Launch and connect via ssh to the Ubuntu 18_04 GUI XFCE Base v2.0 image ( see Atmosphere Manual for help launching and connecting)
If you are using Atmosphere, your sudo password is the same as your login credentials.
- Next, we need to install some dependancies to get Docker to run on our Ubuntu machineapt-get install -y \ apt-transport-https \ ca-certificates \ software-properties-common
- Next we will add a gpg key (so we can connect securely to the Docker repository)curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Now we will add the Docker repository to the list of download sourcesadd-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
- Next, we will update the repository listssudo apt-get update
- Finally, we will install Dockersudo apt-get install -y docker-ce