add volume to running docker container code example

Example 1: docker create volume

$ docker volume create hello

hello

$ docker run -d -v hello:/world busybox ls /world

Example 2: docker create volume

docker volume create [OPTIONS] [VOLUME]

Example 3: docker add volumes to running container

$ docker ps  -a
CONTAINER ID        IMAGE                 COMMAND                  CREATED              STATUS                          PORTS               NAMES
    5a8f89adeead        ubuntu:14.04          "/bin/bash"              About a minute ago   Exited (0) About a minute ago                       agitated_newton

$ docker commit 5a8f89adeead newimagename

$ docker run -ti -v "$PWD/somedir":/somedir newimagename /bin/bash