Error response from daemon: Cannot start container - docker

docker_admin#Ashoka:~$ sudo docker run sqldb
exec format error
Error response from daemon: Cannot start container 4e1b251d50ceda05f7b4dd0d3eebd13a731bab0f9a5ed4486f4303d8b5f5b272: [8] System error: exec format error
I try to run the image it shows this error, but when I run the same image in interactive mode it runs successful.
Do you know why?

This message is produced when the kernel, for whatever reason, doesn't know how to handle the given executable format. It's a problem that's often associated with scripts that don't include a shebang line, or binaries that are incompatible with your system.
Since you're able to run the image interactively, you probably have a badly written script somewhere in your container.
See: https://github.com/moby/moby/issues/10668

Try run command using image TAG, execute docker images and get your TAG.
sudo docker run sqldb:1.0
Maybe you need any initial command too

I have had this problem just now, in an Alpine 3.5 container running in a Mint 18 host. It's not a very helpful error, and as far as I can tell there is no feature to inspect logs unless the container keeps on running.
The problem was this line in my Dockerfile:
ENTRYPOINT ["sleep 500"]
I'm using sleep at present so I can shell into the container and install a few things experimentally before committing it to the Dockerfile. In fact this would have happened if I had tried to put any command with parameters into a single ENTRYPOINT entry. It should have been:
ENTRYPOINT ["sleep", "500"]

Related

docker: Error response from daemon: OCI runtime create failed: invalid mount

I am trying to create an Anonymous Volume with docker but it throws this error:
docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination:C:/Program Files/Git/app/node_modules Type:bind Source:/var/lib/docker/volumes/51c96f13f0232b1d052a91fdb0d8ed60881420ee214aa46ae85e16dfa4bbece0/_data Options:[rbind]}: mount destination C:/Program Files/Git/app/node_modules not absolute: unknown.
I came across this issue today while running hyperledger fabric on windows OS, it seems to be a mounting issue. The error went away when I ran the below command on git bash.
export MSYS_NO_PATHCONV=1
Firstly you must open up the command prompt (powershell/cmd) at your working directory, if feedback is your working directory open up the cmd at feedback and then, in windows, in the powershell/cmd use:
docker run -p (localhost port):(container port) -v %cd%:/app
instead of $(pwd) use %cd% it worked for me. I probably think the issue is with gitbash, you could use powershell instead, I came across the exact same problem just now and gitbash gave the exact same error.
I got a permanent fix for windows, docker volumes has an issue in windows https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693/7. So we could use:
docker run -p 8080:3000 -v /app/node_modules -v //d/Desktop/Docker/react-app/front-end:/app
if your files where in c drive use //c/Desktop/Docker/react-app/front-end:/app instead of //d/Desktop/Docker/react-app/front-end:/app
And yeah remember to use powershell not gitbash it also has an issue.
If your using a react application make sure that you have .env file with CHOKIDAR_USEPOLLING=true
Also, be sure you are running the docker command in the same folder where the docker-compose.yml lives. Otherwise, the docker command can execute fine until it reaches the point where it loads the volume and then trying to access the relative path might cause it to throw the above error.

docker cannot start container: "permission denied"

Upon starting a docker container, I get the following error:
standard_init_linux.go:175: exec user process caused "permission denied"
sudo does not fix it. I have all permissions.
docker-compose only shows the container crashing in the same way.
I use Linux and the Dockerfile is on a cifs-share. Starting from a locally mounted drive, everything works.
As hinted at here the filesystem is no-exec. I.e. executing scripts or binaries from there is not allowed. You can test that by finding e.g. a shellscript, checking it has the execute bit set with ls -l and then try to run it. Furthermore, looking at the mount-parameters can reveal the problem:
//nas.local/home on /cifs/h type cifs ( <lots of options omitted> , noexec)
Interestingly, the command that mounted the share did not explicitly request noexec. However the mount came out this way anyway. Adding -o exec to the mounting command and remounting fixed it.
I solved the issue by changing the top line in train file.
It was
#!/usr/bin/env python
I changed it to:
#!/usr/bin/env python3.5
depending on what version of python i had installed.

Docker: Unable to redirect output to text file?

So I have a shell script, a snippet displayed below
sudo docker start -ai <ContainerID> > /textfile.text
sudo docker cp <ContainerID>:/textfile.text /directorytomoveto/
where I wish to store the output of a process in a text file in the top directory of the container. The container executes the process and the output isn't displayed, which is a good sign. However, I get the following error:
Error response from daemon: Could not find the file /textfile.txt in container <ContainerID>
Anyone see a mistake or a way of fixing this? Thanks.
If you want the container logs, you can simply get them by running docker container logs <containerId>. You can redirect the output to a log file directly on the host.
Moreover, as other have stated the > /textfile.text is executing on the host, and even if it did execute in the container, it would have overriden the container command that starts it, which will make the container process not start.

Running docker container on nanoPI leads to "exec format error"

The goal is to run docker containers on my nanoPI in the same manner as on a ubuntu server machine.
I have recently run into the following error when attempting docker run -it kylemanna/openvpn:
standard_init_linux.go:185: exec user process caused "exec format error"
I also get the same error when executing docker-compose using the container approach
Since I get the problem whether I use docker compose or not, I am starting to think that the error might be my usage of docker on the nanoPI. It may not be supported in the same way.
However, I can execute other containers/images just fine, hello-world, ubuntu, etc.
How do I go about determining the cause of this error? Where is the source code for standard_init_linux.go:185? And, what am I doing incorrectly?
Through trial and error, I discovered that if I rebuilt the openvpn image directly from the github repository on the machine with which the container would be run using (docker build <url>), then this error was resolved for the openvpn container but not (yet) for docker-compose. I imagine rebuilding the docker-compose container will fix the issue with that one too.
This is most likely due to a binary not having been compiled for the machine type that I was using.
Source/Inspiration: https://github.com/moby/moby/issues/23865

docker-compose returning apache2-foreground not found

I have two simple containers, web and db. I built and can successfully up the containers via docker-compose on both Windows and Ubuntu. However, when I attempt to up on Photon, I get the following error for my web container.
Handler for POST /v1.21/containers/.../start returned error: Container command 'apache2-foreground' not found or does not exist.
But when I build the image based on the Dockerfile, and docker run web, it launches and runs fine. Any ideas about this error?
apache2-foreground is a command (script) that calls apache2 -DFOREGROUND (see httpd/php repos/containers). It's the command automatically run by php/httpd containers
If you run into a problem running a command from docker-compose that will ordinarily run with docker then it could probably be a bug - see this for instance
It could also be the case that you actually have bad paths in your docker-compose.yml volume mappings

Resources