Goal
In this step, you will find and exercise a few basic Docker commands on your XNAT Vagrant VM.
Verify your setup
These instructions assume usage of the Docker server installed by default on the XNAT Vagrant VM. To access the server, setup (if necessary) and login to your Day 3 Practical Vagrant VM.
BASH
xnat-workshop-vms$ ./run xnat-31 setup
xnat-workshop-vms$ ./run xnat-31 ssh
This puts you at the console to your XNAT Vagrant VM, which includes an instance of Docker.
Verify Docker installation and functionality:
BASH
xnat@xnat-31:~$ docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.11.0
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host bridge null
Kernel Version: 4.2.0-27-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.954 GiB
Name: xnat-31
ID: 3XVY:66LA:O7YA:ZRXD:5O3L:HR56:FBKD:5CG3:HAV3:JDG7:K3MX:44G7
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
If you see the above output, then your XNAT VM is set up correctly.
Command reference
Here are some commonly used commands, or ones that can give you more information. You don't have to do them now, but you may want to return to this page for reference later if you don't remember how to do something.
docker help
You can learn more about what commands you can give docker using the built-in Docker help documentation.
BASH
xnat@xnat-31:~$ docker help
docker help
can also tell you more about each specific command.
BASH
xnat@xnat-31:~$ docker help <command>
docker images
BASH
xnat@xnat-31:~$ docker images
This lists all the images installed on the local docker server (you will have none right now).
docker ps
BASH
xnat@xnat-31:~$ docker ps
This lists the running containers on your docker server. Again, you will have none right now. If you want to see all containers—including ones that haven't started running or have already finished—you can include the -a
flag.
BASH
xnat@xnat-31:~$ docker ps -a
docker pull
Download an image from a registry (defaults to https://hub.docker.com):
BASH
xnat@xnat-31:~$ docker pull <image_name>[:<tag_name>]
docker run
Create a new container from an image and run a command in that container:
BASH
xnat@xnat-31:~$ docker run [options] <image_name> [command]
Docker documentation
If you need more information about any of the docker commands, you can look through their command-line documentation. All the sub-commands have their own pages with explanations and examples.