The container was created with the commands
docker run --gpus '"'device=$CUDA_VISIBLE_DEVICES'"' --ipc=host --rm -it \
--mount src=$(pwd),dst=/clipbert,type=bind \
--mount src=$OUTPUT,dst=/storage,type=bind \
--mount src=$PRETRAIN_DIR,dst=/pretrain,type=bind,readonly \
--mount src=$TXT_DB,dst=/txt,type=bind,readonly \
--mount src=$IMG_DIR,dst=/img,type=bind,readonly \
-e NVIDIA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES \
-w /clipbert jayleicn/clipbert:latest \
bash -c "source /clipbert/setup.sh && bash" \
But upon exit and running docker ps -a, the container is not listed and it seems like the container is only temporarily created. This has not happened in my previous experience with docker, what may the reason be?
The --rm options tells docker run command to remove the container when it exits automatically.
Related
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.
Runing this one Ubuntu 20 . What is wrong?
Using this tutorial
https://docs.vyos.io/en/latest/installation/virtual/docker.html
#docker run -d --rm --name vyos --privileged -v /lib/modules:/lib/modules > vyos:1.4-rolling-202112080318 /sbin/init
docker: invalid reference format.
See 'docker run --help'.
The tutorial (docs.vyos.io) uses the following command:
docker run -d --rm --name vyos --privileged -v /lib/modules:/lib/modules \
> vyos:1.4-rolling-202111281249 /sbin/init
Notice the \ at the end of the first line. This signals a multi-line command, i.e. the command is continued on the next line. The > at the beginning of the 2nd line is a prompt, i.e. not essential for the command. We can rewrite the command, e.g. as oneliner:
docker run -d --rm --name vyos --privileged -v /lib/modules:/lib/modules vyos:1.4-rolling-202111281249 /sbin/init
Or - what I like to do - put each parameter on a separate line:
docker run \
-d \
--rm \
--name vyos \
--privileged \
-v /lib/modules:/lib/modules \
vyos:1.4-rolling-202111281249 \
/sbin/init
All of those are equivalent.
could dissect this command and explain to me what this does?
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.12.3
Came across a docker run command that uses -w flag.
docker run -v $(pwd):/project \
-w /project \
-p 8081:8081 \
gcr.io/base-project/myoh:v1
Any idea what the -w flag is for?
Just run docker run --help in your shell.
-w, --workdir string Working directory inside the container
https://docs.docker.com/engine/reference/run/#workdir
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