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.
Related
When I copy them to the terminal I get an error: "docker run" requires at least 1 argument.
I don't know why, should I separate them somehow separately or should the whole command go the first time?
You have to add line breaks and your image name
docker run \
--name example-chris \
-v /home/Projects/example-chris/src/main/resources/application.properties:/config/application.properties \
-v SOME_SOURCE:/etc/ssl/certs/ca-certificates.crt \
--rm \
-p 8081:8080 \
SOME_IMAGE_NAME
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.
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