Mounting a volume on host in a docker container

68 views Asked by At

I am trying to mount a directory that exist on the host to a docker container. First I created a volume to that directory, then I tell the container at run time to mount to it. I have yet to get it to work. What am I doing wrong? The host is a ubuntu linux box. The container is apache:latest..

docker volume create --driver local --opt type=nfs --opt o=iocharset=utf8,file_mode=0777,dir_mode=0777 --opt device=/var/www/wasql wasql2
    wasql2
docker run -p 8020:80 -p 2220:22 --network dockernet --mount src=wasql2,target=/var/www/wasql/ -it wasql.image /bin/bash
    docker: Error response from daemon: error while mounting volume '/var/snap/docker/common/var-lib-docker/volumes/wasql2/_data': failed to mount local volume: mount /var/www/wasql:/var/snap/docker/common/var-lib-docker/volumes/wasql2/_data, data: iocharset=utf8,file_mode=0777,dir_mode=0777: invalid argument.
0

There are 0 answers