Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Unknown flag --mount

I want to mount a directory from the host to a container using the mount flag over volume but I am getting ` This is only experienced when using mount flag and not with volume

*Command:*
    docker run -d  -it  --name devtest --mount type=bind,source="$(pwd)",target=/home/  httpd

Error unknown flag: --mount

Server Version: 1.13.1
Storage Driver: aufs
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: "deleted" 
Profile: default
Kernel Version: 4.10.0-42-generic
Operating System: Ubuntu 17.04
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.715 GiB
Name: "deleted"
ID: "deleted"
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
like image 909
Ndifreke Avatar asked Jan 09 '18 12:01

Ndifreke


People also ask

How do I enable docker BuildKit?

If you are running Docker on Linux, you can enable BuildKit either by using an environment variable or by making BuildKit the default setting. To set the BuildKit environment variable when running the docker build command, run: $ DOCKER_BUILDKIT=1 docker build . Buildx always enables BuildKit.

What is docker Buildx?

Docker Buildx is a CLI plugin that extends the docker command with the full support of the features provided by Moby BuildKit builder toolkit. It provides the same user experience as docker build with many new features like creating scoped builder instances and building against multiple nodes concurrently.

What is the docker flag?

But what do those flags mean? The -it flag tells docker that it should open an interactive container instance. The --rm flag tells docker that the container should automatically be removed after we close docker. The -p flag specifies which port we want to make available for docker.

Does docker run automatically pull?

We could have skipped the docker pull step; if you use the docker run command and you don't already have a copy of the Docker image, Docker will automatically pull the image first and then run it.


1 Answers

docker run support for the --mount option was only introduced in Docker 17.06. You are using Docker 1.13.1. You have two choices:

  1. Update to Docker 17.06 or later if you can;
  2. Use the -v approach to bind mount the volume you require e.g. docker run -v $(pwd):/home
like image 104
Rob Blake Avatar answered Sep 25 '22 01:09

Rob Blake