My docker file looks like
FROM grpc/python
CMD ["/bin/ls /"]
It is throwing an error:
container_linux.go:265: starting container process caused "exec: \"/bin/ls /\": stat /bin/ls /: no such file or directory"
docker: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/bin/ls /\": stat /bin/ls /: no such file or directory".
You need to separate the command from the arguments:
CMD ["/bin/ls", "/"]
CMD accepts the following formats:
CMD ["executable","param1","param2"] (exec form, this is the preferred form)
CMD ["param1","param2"] (as default parameters to ENTRYPOINT)
CMD command param1 param2 (shell form)
You have extra space after ls in CMD command on second row
Related
I want to compile my source project with a docker container like this, at first it worked but now it's getting an error
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "go build -o main gitlab.org/repo/user-management/main": stat go build -o main gitlab.org/repo/user-management/main: no such file or directory: unknown.
ERRO[0022] error waiting for container: context canceled
I use jenkins to use this command
stage('Compile Source') {
steps {
sh 'docker run -v $(pwd)/:/app -w /app --name "${containerName}" golang:1.17 go build -o main gitlab.org/repo/user-management/main'
}
}
Has anyone ever compile the source code via docker container?
thank you
I am running a docker-compose test; part of my stack that will perform the actual tests is the following service
tester:
image: tutum/curl:latest
volumes:
- ./ci/wait-for-it.sh:/usr/local/bin/wait-for-it.sh
- ./webhooks:/app/webhooks
depends_on:
- sut
command: ["wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "pytest /app/webhooks"]
The command fails as follows:
ERROR: for 0114c9206690_alerta-_tester_1 Cannot start service tester: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"wait-for-it.sh\": executable file not found in $PATH": unknown
ERROR: for tester Cannot start service tester: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"wait-for-it.sh\": executable file not found in $PATH": unknown
The file being mounted does exist:
▶ ls docker-compose.test.yaml
docker-compose.test.yaml
Workspace/systems-utils/ alerta_dev_infra ✗ 1d ⚑ ◒
▶ ls ./ci/wait-for-it.sh
./ci/wait-for-it.sh
What is more, when trying to bind mount a non-existent file, instead of getting a mount-related error, i get the same error as above
tester:
image: tutum/curl:latest
volumes:
- ./ci/foofile.sh:/usr/local/bin/wait-for-it.sh
- ./webhooks:/app/webhooks
depends_on:
- sut
command: ["wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "pytest /app/webhooks"]
$ docker-compose -f docker-compose.test.yaml up -d
ERROR: for tester Cannot start service tester: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"wait-for-it.sh\": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.
What am I missing?
edit: Regarding the PATH issue mentioned, here it is:
▶ docker run -it tutum/curl:latest printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=1f3090676fa0
TERM=xterm
HOME=/
What is more, the tester service configuration is the exact same as in this project which runs perfectly.
As for the permissions issue:
Workspace/systems-utils/alerta-workable alerta_dev_infra ✗ 1d ⚑ ◒ ⍉
▶ ls -al ./ci/wait-for-it.sh
-rwxr-xr-x 1 pkaramol staff 5.1K Sep 6 22:02 ./ci/wait-for-it.sh
The error message is pretty self-explanatory - wait-for-it.sh is not on $PATH.
You need either add /usr/local/bin to $PATH or change command to
command: ["/usr/local/bin/wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "pytest /app/webhooks"]
See also accepted answer to this question for why /usr/local/bin might not be in path.
Looks like it could not find "executable file in $PATH"
So let's try to set executable permissions on ./ci/wait-for-it.sh file:
$ chmod +x ./ci/wait-for-it.sh
when spinning up docker image [kilna/liquibase-postgres], we are getting:
"/bin/sh: [/bin/sh,: not found"
As a response in the container log and the container is exiting abruptly.
Additional Note: We are using macOS Catalina and default bash is zsh.
Any pointers appreciated. Thank you
The command given in the Dockerfile is incorrect.
"Cmd": [
"/bin/sh",
"-c",
"['/bin/sh', '-i']"
],
It has nested /bin/sh. Argument for the flag -c should be a single string. It can not be an array.
So, it gives docker run kilna /bin/sh: [/bin/sh,: not found error.
Change the CMD as CMD ["/bin/sh", "-c", "/bin/sh -i"], build and run.
$ docker run -it kilna
/ #
I am running the command below in docker file.
CMD [“ bash”, GITHUB_KEY=“######” GITHUB_SECRET=“##########” ./script/server]
When I run it, I get this error message /bin/sh" 1: Syntax error: Unterminated quoted string
You need to have every parameter surrounded by quotes in the CMD instruction.
CMD ["bash", "GITHUB_KEY='######'", "GITHUB_SECRET='##########'", "./script/server"]
I am new in the community, I am working with concourse and I have the next issue running a yml file in terminal using fly:
command $: sudo fly -t ci execute -c task.yml
I get the following error:
initializing Backend error: Exit status: 500, message:
{"Type":"","Message":"runc exec: exit status 1: exec failed: container_linux.go:348: starting container process caused \"chdir to cwd (\"/root\") set in config.json failed: permission denied\"\n","Handle":"","ProcessID":""}
Please help if anyone can help me!