I installed docker on a raspberry-pi (Connected via ssh)
Installation is successful.
But running docker run hello-world produce no output.
Note on very first time I got additional messages regard installing image
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ad0f38092cf2: Pull complete
Digest: sha256:e366bc07db5e8a50dbabadd94c2a95d212bc103e3557e47df8a2eebd8bb46309
Status: Downloaded newer image for hello-world:latest
But there is no actual output from hello world script
Note I installed docker using command curl -sSL https://get.docker.com | sh
I tried following command too
sudo usermod -aG docker pi
sudo systemctl start docker
sudo docker run hello-world
Tried following commands docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
734dd8f733d7 hello-world "/hello" About a minute ago Exited (139) 59 seconds ago thirsty_bhaskara
I ran into the same issue on a Raspberry Pi 1B+ (armv6l). Inspired by #JanDrábek's answer, the first observation is that the hello-world image would indeed be one supporting ARM, yet only after using hypriot/armhf-hello-world instead did I get the expected output:
$ uname -a
Linux 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux
$ docker run hello-world # No output
$ docker image inspect hello-world | grep Architecture # Arch looks right though
"Architecture": "arm",
$ docker run hypriot/armhf-hello-world # This does the job
Hello from Docker.
This message shows that your installation appears to be working correctly.
run:
docker ps -a
and check if you can see the exited container.
take the container ID from the output and type
docker logs <ID>
this will allow you to see the logs.
if you want to see the output in the first place when you run it add -it flags to the run command
edit:
I tried in on my machine:
docker run -it hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:e366bc07db5e8a50dbabadd94c2a95d212bc103e3557e47df8a2eebd8bb46309
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
maybe your output is redirected to some other stream.
try using :
docker run -it hello-world > ./test.txt 2>&1
after that check if the file has any content
I was having similar issue, my solution was definitely very naive but I basically removed all container and images and then tried again. It worked.
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
I recently had same problem on my freshly installed Fedora 28 (up-to-date)... the containers all exited with exit code 139, the docker events said that it died, and docker logs said nothing.
My solution was to update the docker (or switch to CE edition) as the installed docker version was 1.13 which is quite old. (The tutorial for fedora https://docs.docker.com/install/linux/docker-ce/fedora/)
Also I have came across one potential thing to check... is your container compatible with your architecture (raspberry is ARM isn't it?) Use docker image inspect <image> search for Architecture.
Related
I am trying to find if a Docker Container with a specific name exists, but I seem to be unsuccessful. I have found multiple answers from other posts, the most notable one being this one, but I cannot seem to reproduce their success. Their answer returns nothing when it is tried with the container in multiple states (sometimes stopped, sometimes running), but I can't seem to get an output. It is not supposed to do anything if the container is running for right now. The block of code that I've been using is:
if [ ! "$(docker ps -q -f name=mysql80)" ]; then
if [ "$(docker ps -aq -f status=exited -f name=mysql80)" ]; then
# cleanup
docker rm mysql80
fi
# run your container
docker run -d -p 3306:3306 -p 33060:33060 --volume "$MYSQLFOLDERLOCATION":/var/lib/mysql --name mysql80 frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0
fi
I expect this block of code to find the container, and remove it if it is exited. I know this can sometimes be hazardous. I am running macOS 10.15.6 Catalina (latest update), with Docker Desktop 2.3.0.4 (46911).
% docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1300b4021189 frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0 "docker-entrypoint.s…" 6 seconds ago Up 5 seconds 0.0.0.0:3306->3306/tcp, 0.0.0.0:33060->33060/tcp mysql80
4e83c877642b frostedflakez/php-mysql-webserver:0.9-beta.3-php-latest-7.4 "docker-php-entrypoi…" 8 seconds ago Up 6 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp php74
^^^ This is my docker ps output
Your script works for me. First run:
> t
Unable to find image 'frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0' locally
0.9-beta.3-mysql-latest-8.0: Pulling from frostedflakez/php-mysql-webserver
...
5e500ef7181b: Pull complete
af7528e958b6: Pull complete
Digest: sha256:ef35b9e2b11b0b42a40205eba89a2b8320ace58a3c073b43e1770a52a044484b
Status: Downloaded newer image for frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0
8b01dd743c554a8fb79d73bccf683097e531e8eeea3af1062e0414b35401a000
>
Second run:
> t
>
and if I stop the container, and then run the script:
> t
deleting mysql80
mysql80
35ca48875efdc60032b00325dd0563da64a834df0074580051c25e0601573180
>
(I added a echo "deleting mysql80" just to help to know what was going on)
If I stop and delete the container, and run the script, I get:
> t
971309690a97d0b2ffb730feb9f19ab03db10df730d19c91c3482a952a9ebb18
>
I'm running Docker version 19.03.12, build 48a66213fe on a Mac.
I am setting up Docker. I have already run the basic command to see if it is up and running and then I tried another command:
docker run -it ubuntu bash
Which enabled an Ubuntu Bash inside the Docker quick-start terminal.
I am trying to understand the command, what it does and how to end the Ubuntu Bash without restarting the Docker quick-start terminal.
dell#DESKTOP-BCT4208 MINGW64 /c/Program Files/Docker Toolbox
$ docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
35c102085707: Pull complete
251f5509d51d: Pull complete
8e829fe70a46: Pull complete
6001e1789921: Pull complete
Digest:
sha256:d1d454df0f579c6be4d8161d227462d69e163a8ff9d20a847533989cf0c94d90
Status: Downloaded newer image for ubuntu:latest
root#ddabb25c2a2f:/# //ubuntu bash started
to do that you must start your container with -d to run in background:
docker run -itd ubuntu bash
then you can savely type exit or contol-d without killing the container
I am trying to build a new docker image.
docker build . -t tg
.....
.....
Removing intermediate container ba85d1deadeb
---> 353fcb84af6b
Successfully built 353fcb84af6b
Successfully tagged tg:latest
But for some reason, after it is successfully built I could neither run it nor find it.
docker images
<none> <none> c18e928477c3 11 days ago 1.01GB
...... a long list of unrelated images that are intermediate steps of the built process .....
docker image ls , docker images -a aren't helping either.
sudo docker run -i -t 353fcb84af6b
Unable to find image '353fcb84af6b:latest' locally
docker: Error response from daemon: pull access denied for 353fcb84af6b, repository does not exist or may require 'docker login'.
See 'docker run --help'.
when running docker run -i -t tg:latest result is the same.
The issue seems to be specific to THIS particular image... Other successfully built images DO show up after running docker images.
Dockerfile
Any pointers are much appreciated.
On linux
try:
docker buildx build --progress=plain --load .
1- In order to run docker commands, use sudo user.
WHY -> The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo.
Get your images build with sudo docker build -t tag_name --no-cache .
To see the images - sudo docker images
Also, you cannot use tag with image ID - Unable to find image '353fcb84af6b:latest' locally
In order to run your image, you can either use JUST image ID or image_name:tag.
I'm trying to mount a folder (/Users/.../src) on mac inside a docker container :
docker run -v /Users/.../src:/sharedVolume/git_src_on_mac -v <DOCKER_MACHINE_NAME> /bin/bash
and it returns the following error:
Unable to find image '<DOCKER_MACHINE_NAME>:latest' locally
docker: Error response from daemon: repository <DOCKER_MACHINE_NAME> not found: does not exist or no pull access.
I'm using docker for mac Version 1.13.1, and here is the output of docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1ea17c622f80 <DOCKER_MACHINE_NAME> "/test/myproject.sh" About an hour ago Up About an hour 0.0.0.0:32783->5000/tcp <DOCKER_MACHINE_NAME>
Does anyone know what is the issue?
(Got the idea from #FaigB comment): I should have used the name of the image (docker image -a) with latest tag
docker run -v /Users/.../src:/sharedVolume/git_src_on_mac -i -t <DOCKER_IMAGE_NAME>:latest /bin/bash
I built a docker image from a docker file. Build said it succeeded. But when I try to show docker containers through docker ps (also tried docker ps -a), it shows an empty list. What is weird is that I'm still able to somehow push my docker image to dockerhub by calling docker push "container name".
I wonder what's going on? I'm on Windows 7, and just installed the newest version of dockertoolbox.
docker ps shows (running) containers. docker images shows images.
A successfully build docker image should appear in the list which docker images generates. But only a running container (which is an instance of an image) will appear in the list from docker ps (use docker ps -a to also see stopped containers). To start a container from your image, use docker run.
For me, docker ps -a and docker images both returned an empty list even tho I had many docker containers running. I tried rebooting system with no luck. A quick sudo systemctl restart docker fixed this "bug".
try restarting
sudo systemctl restart docker.socket
sudo systemctl restart docker
You can run the command without the -d option.
So you have the output displayed.
It may be that the application failed to start.
For me, the only thing resolving the issue is to reinstall docker. Also, one must be sure that the disk is not full.
This is the command that I use, but it may vary depending on the version of docker already installed:
apt-get install --reinstall docker.io
If prompted, choose "yes" to automatically restart docker daemon
for Linux,
at first, see all the running container
sudo docker ps
try restarting
sudo systemctl restart docker
remove previous docker image with the same name if there is any
sudo docker rm docker_container_id
once again run
sudo docker run -d --name container_name image_name
This should work
or uninstall docker and install it again
In the Dockerfile instructions, make sure the CMD commands are in between double-quotes not single-qoute
for example:
CMD [ "node" , 'index.js'] Here there is a mistake !!
Correct one is :
CMD [ "node" , "index.js"]
This mistake will make the container run and exit immediately.