I am using the gcc image from hub.docker.com here
I am under windows 11, so I need to conver the docker run commad to windows, either cmd or preferably powrshel
linux command to convert
docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp gcc:4.9 gcc -o hello hello.c
what I use in windows
docker run --rm -v /G/Docker/00100_start -w /G/Docker/00100_start/ gcc:4.9 gcc -o hello hello.c
I get this error message
gcc: error: hello.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
What am I doing wrong?
Should I use another way?
Related
So recently came across this weird case where I am trying to access file in my local dir into my container.
When I run the following command on terminal it runs fine and shows the expected list of file
docker run -it --rm -v $(pwd):/mnt/data -w /mnt/data-sink artprod.dev.abc.com/org/cli ls
But when I try to run this via makefile it shows nothing,(I run make in the same path where I run the docker cmd in the previous step)
docker-publish: build
echo "Publishing $(APP_NAME) snapshot $(VERSION)"
docker run -it --rm -v $(pwd):/mnt/data -w /mnt/data-sink artprod.dev.abc.com/org/cli ls
$(shell pwd) worked simply $(pwd) in make didnt do the shell interpolation.
Hello I m trying to follow the step by step guid to build jpeg xl (I m on windows and try to build a x64 version for linux)
after:
docker run -u root:root -it --rm -v C:\Users\fred\source\tools\jpegxl\jpeg-xl-master -w /jpeg-xl gcr.io/jpegxl/jpegxl-builder
I have the container running but I don't know how to run the command inside :
CC=clang-6.0 CXX=clang++-6.0 ./ci.sh opt
I tried CC=clang-6.0 CXX=clang++-6.0 ./ci.sh opt and I get ./ci.sh: No such file or directory no command seems to work when I do "ls" it display nothing
Does someone knows how to get this to build?
Make sure that you start a bash terminal inside the container:
docker run -it <image> /bin/bash
I believe /bin/bash is missing from your docker run command. As a result, you are executing the command for clang inside your own environment, not the container.
You can set the environment variables by using -e
Example
-e CC=clang-6.0 -e CXX=clang++-6.0
The full command to log in into your container:
docker run -u root:root -it --rm -e CC=clang-6.0 -e CXX=clang++-6.0 -v C:\Users\fred\source\tools\jpegxl\jpeg-xl-master -w /jpeg-xl gcr.io/jpegxl/jpegxl-builder /bin/bash
They have updated the image without updating the command so the command is
CC=clang-7 CXX=clang++-7 ./ci.sh opt
The discution is here:
Can't build from docker image "Unknown clang version"
While executing below script,
sudo docker run -volume "$PWD:/build" -volume "~/.m2:/root/.m2" -volume "~/.build:/root/.build"`
i am getting below error:
docker: invalid reference format.
See 'docker run --help'.
OS using is ubuntu-18. Followed some stackoverflow threads, but missing something.
sudo docker run -volume "$PWD:/build" -volume "~/.m2:/root/.m2" -volume "~/.build:/root/.build"
Your command has several issues:
-volume "$PWD:/build" is not proper syntax, you should use --volume "$PWD:/build" or -v "$PWD:/build"
you are missing an image name: docker run require you to specify which image to run, for example maven:3-jdk-8
it seems you are trying to run a Maven build, you should also specify the working directory with -w and Maven goals
For example:
sudo docker run -v "$PWD:/build" -w /build -v "~/.m2:/root/.m2" -v "~/.build:/root/.build" maven:3-jdk-8 mvn clean package
I've been trying to use docker in windows 10 pro. I used it in Mac before. When I try to use the command below, error message was popped up.
Please help.
Command line:
docker run -v db_car_my-db-1:/dbdata -v $(pwd)/backups:/backup --rm ubuntu tar xvf /backup/db_data_19-03-11.tar -C /dbdata --strip 1
Error Message:
C:\Users\lenovo\Downloads\db_car\db_car> docker run -v db_car_my-db-1:/dbdata -v $(pwd)/backups:/backup --rm ubuntu t
ar xvf /backup/db_data_19-03-11.tar -C /dbdata --strip 1
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: invalid reference format.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
I think the problem is $(pwd). If you are running this command on the powershell you should use curly brackets:
docker run -v db_car_my-db-1:/dbdata -v ${pwd}/backups:/backup --rm ubuntu tar xvf /backup/db_data_19-03-11.tar -C /dbdata --strip 1
(see also docker : invalid reference format)
I'm having an issue with docker run syntax... I've tried these 2 commands and they both seem to generate the error message on the last line.
docker run --rm ${DOCKER_ARGS} -i ${BUILD_IMAGE} /bin/bash -c "diff /usr/local/bin/protoc /go/bin/protoc2"
docker run --rm ${DOCKER_ARGS} -i ${BUILD_IMAGE} diff /usr/local/bin/protoc /go/bin/protoc2
diff: /go/bin/protoc2/protoc: No such file or directory
Am I missing something syntax-wise? I'm not sure why it's not running my command properly.
$ sudo cp /bin/ls /bin/ls2
$ docker run --rm -v /bin/ls2:/bin/ls2 ubuntu:16.04 diff /bin/ls /bin/ls2
Binary files /bin/ls and /bin/ls2 differ.
So I am pretty sure that your local mount doesn't exists and creates a directory.
Change your run statement to
docker run --rm ${DOCKER_ARGS} -i ${BUILD_IMAGE} /bin/bash -c "ls -alh /go/bin/protoc2 && diff /usr/local/bin/protoc /go/bin/protoc2"
And you will know what is wrong