How to run interactive Centos 6 within docker - docker

I'm unable to run an interactive session with Centos:6 in docker. Works perfectly with Centos:7
>docker -v
Docker version 18.03.0-ce, build 0520e24302
>docker pull centos:6
...
>docker run -it centos:6
[just returns to my terminal]
>docker pull centos:7
...
>docker run -it centos:7
>[root#f8c0430ed2ba /]#cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
Any idea what is going on ?
I tried with older version of docker and i pulled all new images Centos:6/6.6/6.7/6.8/6.9 and it shows the same problems. I also tried with /bin/bash or sh at the end.
Also i'm sure that it used to work more or less one year ago.
I'm using ArchLinux

It is a known issue that seems to be linked to the Spectre patch:
issue 103 says:
Running a docker run --rm -it centos:6 bash fails with exit status 139 (i.e. bash exits with SIGSEGV) on Linux kernel 4.15.9. Downgrading to 4.14.15 (which is vulnerable to Spectre V1) gets rid of the segfault.

Related

How do I exit from an Ubuntu Bash that I started in Windows 10 Home, using Docker toolbox?

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

Docker run does not display any output

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.

Running docker 1.13.1 container as daemon and telling to wait for interactive input - still stops

I have done like here:
Docker run normally but docker ps show nothing
sudo docker run -dit $DOCKERID/symfony_3_subscribers_in_file_demo
It gives output long string of letters and numbers
When I run
sudo docker ps
there are no running containers. If I run
sudo docker ps -a
there are containers with status Exited (1)
Dockerfile:
FROM 1and1internet/ubuntu-16-apache-php-7.2:latest
COPY . /var/www/demo
EXPOSE 80
What is wrong here?
Update
Even when commenting out all lines besides
EXPOSE 80
then building image:
sudo docker image build --tag $DOCKERID/symfony_3_subscribes_in_file_demo .
and running same way the container - nothing changes, process still stops.
Update
As Maxim Zaslavsky wrote, checked the log - it shows:
standard_ini_linux.go:178: exec user process caused "exec format error"
The ubuntu-16-apache-php-7.2 image is built on top of ubuntu-16-apache, itself on top of ubuntu-16.
That last images includes:
ENTRYPOINT ["/bin/bash", "-e", "/init/entrypoint"]
CMD ["run"]
with this as an entrypoint script.
I tried to install higher, but did not manage to. The latest version requires 64 bit ubuntu.
That seems to be the issue here: the image assumes a 64-bits host, but your Ubuntu VM is 32-bits: try with a 64-bits one instead.
The base ubuntu-16 image is built on top of Ubuntu-xenial, marked as:
Update to 20171214 for amd64 (amd64)
If you cannot see an option for 64-bits in your VirtualBox, it probably is because Intel VT-x/AMD-V is not yet enabled in the the BIOS.
Exited (1) means the process in the container exited with code 1, likely meaning an error occurred.
You can peek into the logs as follows:
docker run -d -it --name my-container $DOCKERID/symfony_3_subscribers_in_file_demo # name it
docker ps -a # check to see whether it exited
docker logs my-container # look up the logs for this container

Docker Inside a Docker on Windows

I have seen docker inside docker docker container for Ubuntu/Linux. As per the replies in this thread, the following command works
docker run -v /var/run/docker.sock:/run/docker.sock -v $(which docker):/bin/docker [your image
Are there any similar commands available for docker in Windows 7?
I am using the below command in Windows 10 to run docker inside docker. The docker image is with alpine OS. Note that the path is //var/run/docker.sock
docker run -it --rm --privileged --name dockerindocker -v //var/run/docker.sock:/var/run/docker.sock docker
/ # docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02285c22006f docker "docker-entrypoint..." 3 seconds ago Up 2 seconds dockerindocker
/ # cat /etc/alpine-release
3.6.2
Unfortunately Windows doesn't support true docker-in-docker yet.
All the answers here are about running a docker client in a container which connects to the top level docker server on the host (same docker running the container where you invoke docker from). It is not a real docker in docker.
See discussion here for more details https://github.com/docker-library/docker/issues/49

Can't run Raspbian container on 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.

Resources