Back

Introduction

https://fast.wistia.com/embed/medias/1ok76kleuw

Docker Hub https://hub.docker.com
acc:jpcloud

Install docker

wget -qO- https://get.docker.com/ > docker_install.sh
sh ./docker_install.sh

Start docker

service docker start

Test docker

docker run hello-world

Run commands from container

docker run ubuntu:14.04 echo "hello world"
docker run ubuntu:14.04 ps ax

Run container and connect to shell

docker run -i -t ubuntu:14.04 /bin/bash
NOTE: [cntl+p+q] leaves the shell but keeps the container running.
docker attach <containerid>   [connect to running container]

List containers

docker ps       [lists running containers]
docker ps -a    [lists all containers]

Run container and view standard out

docker run -d centos:7 ping 127.0.0.1 -c 50
docker logs <centos containerid>
docker logs -f <centos containerid>   [similar to tail -f]

Run web application container with ports

docker run -d -P tomcat:7
docker ps    [use this to see port mappings]