how to change the directory of docker - 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.

Related

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

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... ?

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

Question about command to execute when running Jenkins image

I have questions while using the Jenkins image to check the commands to run the container and leave a question.
I ran the following command.
docker run \
-u root \
--rm \
-p 8080:8080 \
--name jenkins \
-v /Users/newbie/jenkins:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkins:lts
What does ' : ' and ' -v ' mean in -v /Users/newbie/jenkins:/var/jenkins_home \ on line 6?
-v = Bind mount a volume. See this
It mounts /Users/newbie/jenkins directory on your host to /var/jenkins_home on your container

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

How to run enlightenment wayland in docker container?

I am trying to run enlightenment(https://www.enlightenment.org/start) in a docker container,previously enlightenment is based on X11,but the latest version of enlightenment support wayland. As I searched,we can use the -v parameter when use the "docker run" command to start a docker image like :
$ docker run -it \
--net host \ # may as well YOLO
--cpuset-cpus 0 \ # control the cpu
--memory 512mb \ # max memory it can use
-v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
-e DISPLAY=unix$DISPLAY \ # pass the display
-v $HOME/Downloads:/root/Downloads \ # optional, but nice
-v $HOME/.config/google-chrome/:/data \ # if you want to save state
--device /dev/snd \ # so we have sound
--name chrome \
jess/chrome
(Reference: https://blog.jessfraz.com/post/docker-containers-on-the-desktop/)
But this is based on X11.Currently I do not use the X11,and use the wayland based enlightenment,How can I show my enlightenment UI in docker container?
According to
https://unix.stackexchange.com/questions/330366/how-can-i-run-a-graphical-application-in-a-container-under-wayland
you mount some device such as
/run/user/1000/wayland-0
in your
docker run
command
and here is an extract from
https://github.com/duzy/docker-wayland/blob/master/run.sh
docker run \
--name $container \
-v "$(pwd):/home/user/work" \
--device=/dev/dri/card0:/dev/dri/card0 \
--device=/dev/dri/card1:/dev/dri/card1 \
--device=/dev/dri/controlD64:/dev/dri/controlD64 \
--device=/dev/dri/controlD65:/dev/dri/controlD65 \

Resources