Dockerfile usage

From wikinotes

See dockerfile syntax .

# build image from dockerfile
docker build  -f /path/to/Dockerfile   -t <image_name>   /path/for/container

# build container from image (and run interactively)
docker run \
    --name <container_name>  \
    -v /home/progs:/progs    `# mount /home/progs in container as /progs` \
    -p 80:8080               `# expose container 80 as host 80` \
    -ti <image_name> /bin/bash

# use created container
sudo docker start  <container_name>               # run already created container
sudo docker exec -ti <container_name>  /bin/bash  # attach to started container (run as much as you'd like)