Docker: Unable to mount volume - docker

I am trying to mount the volume on my customized image.
docker run --rm -v models:/volumes/models <image-name>:latest
or
docker run --rm <image-name>:latest
Its throwing same error for both commands:
docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination:[/volumes/models] Type:bind Source:/mnt/data/docker/volumes/beb849ff1498450a01aa69c9b143e51b15fc8d97316d318cfbd4ab72f60656de/_data Options:[rbind]}: mount destination [/volumes/models] not absolute: unknown.
My Docker version is :
Docker version 19.03.13, build 4484c46d9d
To crosscheck the image, I have mounted the same volume on another server and it worked
Am I missing something?

Related

Error: No such container: lambda_run - DOCKER

I am having trouble creating a lambda .zip file in docker. I have followed a few tutorials but to no avail. I keep getting this error when running my .sh file
Unable to find image 'google_analytics_layer:latest' locally
docker: Error response from daemon: pull access denied for google_analytics_layer, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
no such directory
Error: No such container: lambda_run
Error: No such container:path: lambda_run:/python.zip
Error response from daemon: No such container: lambda_run
Error: No such container: lambda_run
docker: invalid reference format.
See 'docker run --help'.
no such directory
Error: No such container: lambda_run
Error: No such container:path: lambda_run:/python.zip
Error response from daemon: No such container: lambda_run
Error: No such container: lambda_run
Here is the code that I'm running
container_name=lambda_run
docker_image=google_analytics_layer
docker run -td --name $container_name $docker_image
docker cp ./requirements.txt $container_name:/
docker exec -i $container_name /bin/bash < ./docker_install.sh
docker cp $container_name:/python.zip python.zip
docker stop $container_name
docker rm $container_name
and this is the tutorial that I followed: https://www.youtube.com/watch?v=jXjMrWCpaI8
As with any list of steps, when one step depends on another you need to stop if there's an error. Your error is in the first step. You need to locate the image google_analytics_layer that you are looking for.
The script you are trying to run is clearly labelled runner.sh in the tutorial. It's to help you run the docker image. You need to create it before you can run it.
To create it:
docker build . -t google_analytics_layer

Docker Run Image Error no such file or directory

i try to run a docker image with this command:
docker run 7ce2964461cc
but get this error:
docker: Error response from daemon: error creating overlay mount to /var/lib/docker/overlay2/2900f69b23f22f96e520a3c8ec8681cb092c2e52bdfbb5e261ad130de1502df4-init/merged: no such file or directory.
try docker inspect 7ce2964461cc
1 to see the port to need to map -p port_inside=port_outside
2 the env varaible ou need to set -e KEY=VALUE
3 perhars mount a file inside docker -v XX:YY

How to mount a windows folder in docker container?

On my windows notebook I try to share a folder with my docker container, but I am getting a weird error message that does not tell me anything.
docker run -p 9999:9999 -it msmint/msmint:latest -v c:/Users/swacker/MINT:/data/
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "-v": executable file not found in $PATH: unknown.
The /data folder in the docker file is present and I gried different formats for the windows path such as C:\User\swacker\MINT.
It complains that an executable file is not found, but I don't know which one.
Options for docker need to go before the image name. Anything after the image name is a command for the container and replaces any defined CMD in the image.
So you need to do
docker run -p 9999:9999 -it -v c:\Users\swacker\MINT:/data/ msmint/msmint:latest
I've changed the slashes in your Windows path to backslashes.

`$PATH: unknown` error when mounting the current directory in Docker

I want to use Docker to manage multiple Python versions (I recently got a Mac with Apple Silicon and I use old Python environment).
Since I need to read Python scripts on Docker and save the output files (for later use outside the Docker environment), I tried to mount a folder (on my Mac) following this post.
However, it shows this error:
$ docker run --name dpython -it python-docker -v $(pwd):/tmp /bin/bash
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "-v": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container: context canceled
It works without -v $(pwd):/tmp. I tried to specify different folders such as ~/ and /Users/ but they didn't work.
You must specify the volume before the image name:
$ docker run --name dpython -it -v $(pwd):/tmp python-docker /bin/bash

How to mount an Arvados FUSE to a Docker container as volume

I would like to add a file system view of Arvados Keep to a Docker container. I created this file system view with arv-mount and it is based on File System in Userspace (FUSE).
Approach 1
$ docker run --rm -it -v /home/test/arv:/opt ubuntu:hirsute bash
docker: Error response from daemon: error while creating mount source path '/home/test/arv': mkdir /home/test/arv: file exists.
Approach 2
I also tried bind mounts
$ docker run --rm -it --mount type=bind,source=/home/test/arv,target=/opt,bind-propagation=rshared ubuntu:hirsute bash
docker: Error response from daemon: invalid mount config for type "bind": stat /home/test/arv: permission denied.
Both approaches I tried as non-root user (I configured Docker for non-root users) and root user.
I made it working by
Adding user_allow_other to /etc/fuse.conf
Creating FUSE mount with arv-mount --allow-other /home/test/arv

Resources