Can't run Raspbian container on docker - docker

So I've installed the hypriot OS for docker and I have tested it with ocker run -d -p 80:80 hypriot/rpi-busybox-httpd. All is well and the test works.
However, when I run docker run -i -t resin/rpi-raspbian to get raspbian nothing happens and docker ps shows no containers running. There are no error messages.
What is happening to my raspbian container?
Thanks

Running on Mac OSX and having downloaded the resin/rpi-raspbian image, I issue the command:
docker run -i -t resin/rpi-raspbian /bin/bash
which starts the container and puts me at the command prompt in raspbian.

Related

Docker - unknown command "run"

I am trying to run a docker container on an Ubuntu WSL2 instance on Windows 10. Docker version installed in 20.10.17. I have been able to run docker commands and build the image successfully.
The output of docker images:
When I try to run the container using the command docker run -p 5000:5000 test it gives the following error:
I have never had this issue with docker before and not sure why it thinks it's an npm command. Does anyone know why this is happening?

Can't acces apache on docker from my network

I have this Dockerfile :
FROM ubuntu:20.04
EXPOSE 80
After installing apache2 package in the container I can't acces the default page of apache from the network. Also docker is in a virtual machine with debian 10. If I try the official apache image (https://hub.docker.com/_/httpd) everything works fine but I want to know why installing it manually doesn't work.
To build the container from the image I use this command :
sudo docker run --name ubuntu -p 80:80 -it ubuntu /bin/bash
I have run the exactly same test on my virtual centos machine and found working.
I've build the image using your dockerfile and run apache installation using below command.
docker build -t ubuntu
docker run --name ubuntu -p 80:80 -it ubuntu /bin/bash
and In terminal opened by the above mentioned command, i ran the below command.
apt-get update
apt-get install apache2
service apache2 start
After that opened another ssh terminal keeping the current running as i have not run the Ubuntu container in detached mode and checked by using.
docker ps -a
and found container is running with exposing 0.0.0.0:80 and checked
curl localhost
Please make sure you have not stoped docker container before running curl command or hit in the browser as its not run in detached mode or background.

why can i not run a X11 application?

So, as the title states, I'm a docker newbie.
I downloaded and installed the archlinux/base container which seems to work great so far. I've setup a few things, and installed some packages (including xeyes) and I now would like to launch xeyes. For that I found out the CONTAINER ID by running docker ps and then used that ID in my exec command which looks now like:
$ docker exec -it -e DISPLAY=$DISPLAY 4cae1ff56eb1 xeyes
Error: Can't open display: :0
Why does it still not work though? Also, how can I stop my running instance without losing its configured state? Previously I have exited the container and all my configuration and software installations were gone when I restarted it. That was not desired. How do I handle this correctly?
Concerning the X Display you need to share the xserver socket (note: docker can't bind mount a volume during an exec) and set the $DISPLAY (example Dockerfile):
FROM archlinux/base
RUN pacman -Syyu --noconfirm xorg-xeyes
ENTRYPOINT ["xeyes"]
Build the docker image: docker build --rm --network host -t so:57733715 .
Run the docker container: docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY so:57733715
Note: in case of No protocol specified errors you could disable host checking with xhost + but there is a warning to that (man xhost for additional information).

How to run Go program after making a CPU limit in a docker container?

I have created a docker container for my Go program and I am able to run that code within that container successfully. I have created a docker network to run that code. I have used the following command:
docker run --network network_name -it go_program Github_repo -l 10000 -secio
Now to test my program I am trying to provide a maximum fixed cpu resource(40%) to the container. I have used the following command to do that:
sudo docker run -it --cpus=".4" ubuntu
But after that when I try to run my program it always says it doesn't recognize the command:
shihab#shihab-VirtualBox:~$ sudo docker run -it --cpus=".4" ubuntu
root#67637cc7edd1:/# sudo docker run --network network_name -it go_program Github_repo -l 10000 -secio
bash: sudo: command not found
How can I solve this issue? Thanks.
Yes , becuase when you run sudo docker run -it --cpus=".4" ubuntu
you go into the container , and then you run the second command inside the container which is not working
Instead you need to just run one command , all in one:
sudo docker run --network network_name --cpus=".4" -it go_program Github_repo -l 10000 -secio
here I assume that go_program is the docker image containing your go program

docker: Cannot connect to the Docker daemon on Mac OS X

I got the following error when I run docker. Does anybody know how to fix the problem. The OS is Mac OS X.
$ docker --version
Docker version 17.12.0-ce, build c97c6d6
$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
You can restart Docker with the following
Stop Docker for Mac gracefully
Stop all Docker containers without confirmation (make sure nothing is running in Docker)
docker ps -q | xargs -L1 docker stop
Requires all Docker containers are stopped
test -z "$(docker ps -q 2>/dev/null)" && osascript -e 'quit app "Docker"'
Start Docker gracefully
open --background -a Docker
I just found out that I have to restart my docker desktop as well. I had no idea that docker desktop and terminal's docker command are related. But now, apparently, they are related. If anyone encounters similar problems, remember to try restart your docker desktop and wait for it to get running!

Resources