Run a Docker container with a folder attached
$ docker run -it -v <path/to/folder>:</path/in/container> <container_name>
Commiting to new image
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
$ docker commit c3f279d17e0a svendowideit/testimage:version3
f5283438590d
$ docker images
REPOSITORY TAG ID CREATED SIZE
svendowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB
Add user (in this case ec2-user
but you can find out your existing user using whoami
) to docker group so you don't need sudo every time:
$ sudo usermod -a -G docker ec2-user