docker run -v : [Errno 2] No such file or directory - docker

I'm trying to run
docker run --rm -v ~/.aws:/root/.aws \
-v $(pwd)/scripts:/root/scripts \
--link "${DYNAMO_CONTAINER}:localhost" \
amazon/aws-cli dynamodb batch-write-item \
--request-items file:///root/scripts/sampledata.json \
--endpoint-url http://localhost:8000
The error I am getting is
Error parsing parameter '--request-items': Unable to load paramfile file:///root/scripts/sampledata.json: [Errno 2] No such file or directory: '/root/scripts/sampledata.json'
I have also tried
docker run --rm -v ~/.aws:/root/.aws \
-v $(pwd)/scripts:/root \
--link "${DYNAMO_CONTAINER}:localhost" \
amazon/aws-cli dynamodb batch-write-item \
--request-items file:///root/scripts/sampledata.json \
--endpoint-url http://localhost:8000
and
docker run --rm -v ~/.aws:/root/.aws \
-v $(pwd)/scripts:/root \
--link "${DYNAMO_CONTAINER}:localhost" \
amazon/aws-cli dynamodb batch-write-item \
--request-items file:///root/sampledata.json \
--endpoint-url http://localhost:8000
On the last one I'm still getting a No such file... error although with a different path.
The structure of the host scripts directory is
scripts
├── sampledata.json
└── other.sh
What am I doing wrong... ?

Related

How to open a rviz, a qt application, in vscode-remote?

I am trying to run a ros project inside a vscode-remote container where the images would be running on the current machine.
It needs to be able to communicate to other nodes outside of the containers and able to use vizualisation tools like rviz which uses qt library.
I installed nvidia-docker2 and was able to start the image on it's own and start rviz.
However when running the command in vscode-remote, some parameters don't seem to work.
This is the command I used to run my image using cli:
docker run -it --rm \
--name noetic_desktop \
--hostname noetic_desktop \
--device /dev/snd \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
-v `pwd`/../Commands/bin:/home/user/bin \
-v `pwd`/../ExampleCode:/home/user/ExampleCode \
-v `pwd`/../Projects/catkin_ws_src:/home/user/Projects/catkin_ws/src \
-v `pwd`/../Data:/home/user/Data \
-env="XAUTHORITY=$XAUTH" \
--gpus all \
noetic_image:latest \
bash
And this is the config I am running for vscode-remote extension.
devcontainer.json :
{
"name": "Existing Dockerfile",
"context": "..",
"dockerFile": "../Dockerfile",
"runArgs": ["--env='DISPLAY'","--gpus all"],
"containerEnv": {
"QT_X11_NO_MITSHM": "1",
"XAUTHORITY": "${localEnv:XAUTH}"
}
}
For opening the image in cli I am doing :
docker run -it --rm \
--name noetic_desktop \
--hostname noetic_desktop \
--device /dev/snd \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
-v `pwd`/../Commands/bin:/home/user/bin \
-v `pwd`/../ExampleCode:/home/user/ExampleCode \
-v `pwd`/../Projects/catkin_ws_src:/home/user/Projects/catkin_ws/src \
-v `pwd`/../Data:/home/user/Data \
-env="XAUTHORITY=$XAUTH" \
--gpus all \
noetic_image:latest \
bash
However when I try to open it in vscode I get an unknown flag on the gpu argument.
Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/home/crossing-laptop/Documents/Code/docker/ros-in-container,target=/workspaces/ros-in-container --mount type=volume,src=vscode,dst=/vscode -l devcontainer.local_folder=/home/crossing-laptop/Documents/Code/docker/ros-in-container -e QT_X11_NO_MITSHM=1 -e XAUTHORITY= --env='DISPLAY' --gpus all --entrypoint /bin/sh vsc-ros-in-container-ea1fa5d968381e26dee62839190e6131-uid -c echo Container started
unknown flag: --gpus all
For reproduce ability, you can find the files at https://github.com/tomkimsour/ros-in-container.

how to change the directory of docker

-- I installed docker on my debian 8
-- I pulled docker-handbrake from https://github.com/jlesage/docker-handbrake
docker pull jlesage/handbrake
and installed it
-- I had 2 drives,
the first one is my OS drive which mounted on /
the second one is my storage drive which mounted on /srv
so the thing I want to do is run handbrake docker directories on /srv with the following command
--name=handbrake \
-p 5800:5800 \
-v /docker/appdata/handbrake:/config:rw \
-v /srv:ro \
-v /srv/HandBrake/watch:/watch:rw \
-v /srv/HandBrake/output:/output:rw \
jlesage/handbrake
but i got this error :
docker: Error response from daemon: invalid bind mount spec "/srv:ro": invalid volume specification: '/srv:ro'.
See 'docker run --help'.
I can do something like this.
--name=handbrake \
-p 5800:5800 \
-v /docker/appdata/handbrake:/config:rw \
-v /srv:/storage:ro \
-v /srv/HandBrake/watch:/watch:rw \
-v /srv/HandBrake/output:/output:rw \
jlesage/handbrake
Or
--name=handbrake \
-p 5800:5800 \
-v /docker/appdata/handbrake:/config:rw \
-v /:/storage:ro \
-v /srv/HandBrake/watch:/watch:rw \
-v /srv/HandBrake/output:/output:rw \
jlesage/handbrake
Note: Make sure you are not changing container directory which /storage:ro . Just change your host directory or path.

docker volume not found for configuration option

I am trying to run this docker command
docker run --rm --name lighthouse -it \
-v $PWD/test-results/lighthouse:/home/chrome/reports \
-v $PWD/lighthouse:/lighthouse \
--cap-add=SYS_ADMIN femtopixel/google-lighthouse \
--config-path=/lighthouse/config/custom-config.js \
$full_url \
--output html \
--output json
But it is not picking up the --config-path argument, somehow I have the volume mapped wrong.
I am trying to create a volume called lighthouse but I get this error:
/usr/bin/entrypoint: 11: exec:
--config-path=/lighthouse/config/custom-config.js: not found
You should be sending the url as the first parameter I think
docker run --rm --name lighthouse -it \
-v $PWD/test-results/lighthouse:/home/chrome/reports \
-v $PWD/lighthouse:/lighthouse \
--cap-add=SYS_ADMIN femtopixel/google-lighthouse \
$full_url \
--config-path=/lighthouse/config/custom-config.js \
--output html \
--output json

Jenkins location in docker, not at /var/jenkins_home

I'm installing Jenkins via docker by following this official guide.
After running command:
docker run \
-u root \
--rm \
-d \
-p 8080:8080 \
-p 50000:50000 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
I'm expecting Jenkins to be installed # /var/jenkins_home, but instead it is being installed # /var/lib/docker/volumes/jenkins-data.
Also there is no such folder as /var/jenkins_home.
Am I missing something. Please suggest.
Thank You
/var/jenkins_home is inside the container. You are using named volume & that's why it's located in /var/lib/docker/volumes/jenkins-data.
Instead, you can use host bind mounts as below to ensure you get the data in /var/jenkins_home on the host machine -
docker run \
-u root \
--rm \
-d \
-p 8080:8080 \
-p 50000:50000 \
-v /var/jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
Volumes path in case of host mounts has to be absolute else it results in creating a named volume.

How do I choose a folder to store files from Docker?

I've been working on this for hours, but I've mainly found answers relating to Linux.
I'm running Docker in Windows 10, and I'm trying to install some distros from Linuxserver
I can do a basic setup (following a guide that install Jackett a similar way)
docker create --name=jackett \
--restart=always \
-v /home/docker/jackett/config:/config \
-v /home/docker/jackett/downloads:/downloads \
-e PGID=1001 -e PUID=1001 \
-e TZ=Europe/London \
-p 9117:9117 \
linuxserver/jackett
But, I don't understand how to select one of the shared drives I setup, and I have no idea where /home/... is on my hard drive.
How would I set this up to save config and downloads in say:
H:\Documents\Configs
docker volume definitions are in pairs
-v left_side:right_side
where full path of left side is a directory local to the machine where you are executing your docker command from ... your laptop or server ... whereas the right_side is same directory as viewed from inside the freshly launched container ... that is you are mounting a local dir to your container so it can read and write to persist changes even after the container is killed off
For example I want to make visable to my app the dir on my laptop of
/some/full/path/local/dir
and the app will see this as path
/whatever/dir
so syntax would look like this
docker ... skip settings ... -v /some/full/path/local/dir:/whatever/dir
My guess is if your host machine is MS Windows then use Windows \ separators rather than linux / separators
docker ... skip settings ... -v c:\some\full\path\local\dir:/whatever/dir
so this would be linux host syntax
docker create --name=jackett \
--restart=always \
-v /some/config/dir:/config \
-v /some/config/dir:/downloads \
-e PGID=1001 -e PUID=1001 \
-e TZ=Europe/London \
-p 9117:9117 \
linuxserver/jackett
whereas this is MS Windows syntax using \ instead of / as seperator
docker create --name=jackett \
--restart=always \
-v H:\\Documents\\Configs:/config \
-v H:\\Documents\\Configs:/downloads \
-e PGID=1001 -e PUID=1001 \
-e TZ=Europe/London \
-p 9117:9117 \
linuxserver/jackett
UPDATE - notice the double \ which might work on Windows since a single \ just means do an escape on following character ... Also leave as is the last line of above linuxserver/jackett as that is not a path its the docker image name
on ubuntu I just ran below just fine
docker create --name=jackett_stens \
--restart=always \
-v /home/khufu/src/config:/config \
-v /home/khufu/src/config:/downloads \
-e PGID=1001 -e PUID=1001 \
-e TZ=Europe/London \
-p 9117:9117 \
linuxserver/jackett
above output is
khufu#jill ~ $ docker create --name=jackett_stens \
> --restart=always \
> -v /home/khufu/src/config:/config \
> -v /home/khufu/src/config:/downloads \
> -e PGID=1001 -e PUID=1001 \
> -e TZ=Europe/London \
> -p 9117:9117 \
> linuxserver/jackett
Unable to find image 'linuxserver/jackett:latest' locally
latest: Pulling from linuxserver/jackett
f2233041f557: Already exists
53bd17864f23: Pull complete
02efc09c990b: Pull complete
14b057e5c85e: Pull complete
7e03e93fc218: Pull complete
9825bf39efb1: Pull complete
0a74d4d4cac0: Pull complete
34451e5c900f: Pull complete
5453d859f994: Pull complete
d9976cfaf0ba: Pull complete
09ccdb48553d: Pull complete
Digest: sha256:b624cbc75efb40d7dab9a2095653988632a4773ad86e0f5ee2edd877e4178678
Status: Downloaded newer image for linuxserver/jackett:latest
dddfae776bfc32c3a55de1ddc08c04e2574ecb3c950ba9bb88f477e3e240121e
OK so above worked then I launched the image using
docker start jackett_stens
and confirmed it is running by issuing
docker ps

Resources