The official image ubuntu18.04 of the installed Docker
PS C:\Users\17293> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 18.04 4eb8f7c43909 2 weeks ago 63.1MB
PS C:\Users\17293> docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
12910e0535ad ubuntu:18.04 "bash" 2 hours ago Up 2 hours mineos
I tried poweroff, shutdown and halt, but how can I shutdown?
root#12910e0535ad:/# uname -a
Linux 12910e0535ad 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
root#12910e0535ad:/# poweroff
bash: poweroff: command not found
root#12910e0535ad:/# shutdown
bash: shutdown: command not found
root#12910e0535ad:/# halt
bash: halt: command not found
root#12910e0535ad:/#
From the host you can use stop:
docker stop container_ip/name
From the container itself, if you have an interactive command line, use exit
Related
Inside an ubuntu docker container based on this image:
docker.elastic.co/elasticsearch/elasticsearch:7.7.0
I am trying to run apt-get install (yes I am aware I should build a new image from a dockerfile but still trying to understand why it fails) but get the below error:
# uname -a
Linux 217054a34cb7 5.3.0-55-generic #49-Ubuntu SMP Thu May 21 12:47:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# apt-get install
bash: apt-get: command not found
From what I can see the above is ubuntu so whats up with bash: apt-get: command not found?
UPDATE:
Its CentOS:
# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
So it works with:
yum install openssl
But why does
# uname -a
Linux 217054a34cb7 5.3.0-55-generic #49-Ubuntu SMP Thu May 21 12:47:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
return Ubuntu SMP?
The elasticsearch image isn't Ubuntu based.
Docker isn't emulating a kernel, instead it uses the (already running) kernel of the host system in every container, so the kernel information in every container will be the kernel information of the host. Your host is Ubuntu, but the image isn't.
When I run this command to run docker(Docker version 18.09.6, build 481bc77156):
sudo docker run -p 18084:8070 -v /opt/dabai/app/config-center/docker-apollo/apollo-portal/target/apollo-portal-1.4.0-github:/apollo-portal:rw apollo-portal
The output is:
[daai#iZ3refzweg1d9dh94t9Z ~]$ sudo docker run -p 18084:8070 -v /opt/dabai/app/config-center/docker-apollo/apollo-portal/target/apollo-portal-1.4.0-github:/apollo-portal:rw apollo-portal
Fri May 31 07:59:06 UTC 2019 ==== Starting ====
Failed to start
Fri May 31 07:59:16 UTC 2019 Failed to start apollo-portal.jar, return code: 1
I use this command to check the docker's log:
docker logs ce518631ced
the output is the same.How do i detect where is the problem is? By the way, when I remove the volume mapping, the container starts up successfully.
Copy container files to local machine to replace old mapping folder could solve this problem.
docker cp 12ba0764beff:/apollo-portal /opt/dabai/app/docker/apollo/apollo-portal
12ba0764beff is the container id.start docker with mapping:
sudo docker run -p 18084:8070 -v /apollo-portal /opt/dabai/app/docker/apollo/apollo-portal:/apollo-portal:rw apollo-portal
How to start the stopped ubuntu container in docker? any idea?
$docker pull ubuntu
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 7698f282e524 29 hours ago 69.9MB
$docker run ubuntu
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
512009f5b00e ubuntu "/bin/bash" 39 minutes ago Exited (0) About a minute ago sad_noether
$docker start sad_noether
sad_noether
$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
512009f5b00e ubuntu "/bin/bash" 40 minutes ago Exited (0) 23 seconds ago sad_noether
$docker exec -it sad_noether bash
Error response from daemon: Container 512009f5b00e6be5e3ee199d2db25c628219c237b16e37eed5cb6052179ebdbc is not running
How to start the stopped ubuntu container in docker?
docker start CONTAINER
In your case, you ran ubuntu without any foreground process, so the container exits immediately when you start it.
You should run docker run -it ubuntu bash
You should run this to keep the container running.
docker run -d ubuntu sleep 9999999
docker run -it centos /bin/bash
to run the container the first time and exit.
docker ps -a
to see that container is stopped.
docker start -ai [CONTAINER_ID]
to start the existing container.
You are into the container!
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.
I was thinking that 64 bit host machine can launch 32 bit LXC as we have a option of specifying arch during LXC creation.
hostmc$> lxc-create -n ubuntu -t ubuntu -- i386
Host machine:
hostmc$> uname -a Linux D 3.11.0-26-generic #45~precise1-Ubuntu SMP Tue Jul 15 04:02:35 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
But then on login in to the 32 bit LXC container, I find uname -a specify the arch as x86_64 and even running file command also specify the arch as x86_64 instead of i386
hostmc$> lxc-console -n ubuntu
ubuntu#ubuntu:~$ uname -a
Linux ubuntu 3.11.0-26-generic #45~precise1-Ubuntu SMP Tue Jul 15 04:02:35 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
ubuntu#ubuntu:~$ file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x37cdd635587f519989044055623abff939002027, stripped
On my Debian 8.2 (jessie), I get:
root#srv1:~# uname -a
Linux srv1 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) x86_64 GNU/Linux
root#srv1:~# lxc-create -n vm -t debian --dir /data/vm -- -a i386
...
root#srv1:~# lxc-start -n vm
...
(in the VM)
root#vm:~# uname -a
Linux vm 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) i686 GNU/Linux
The key difference with your example is the -a flag.
Although this is late, but it might be helpful to someone.
I did it in Ubuntu Bionic with a Bionic 32-bit guest with the following:
sudo lxc launch images:ubuntu/18.04/i386 GuestName
# run with
sudo lxc exec GuestName bash
and uname -a returns:
Linux MachineName 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 i686 i686 i686 GNU/Linux
So it's 32-bit, and the application I'm debugging confirmed it.
When the host runs a 64 bit system the containers will always show a 64 bit system when you execute uname.
Containers and the host share the same Linux kernel instance. Containers are encapsulated processes but they still run in the host kernel. And if the host kernel is a 64 bit kernel the container processes are always processes that are executed 64 bit.