-1

Below the steps one by one, none delivered an error output but even that the container doesn't run after performing them:

1. Container Creation with no errors

~$ sudo docker container run -d -p 81:22 --name test3 ubuntu
866a390866d1aed2d4e550ba6ec6bed1742093c179612758aa291cdc17e01dcb

2. Not listed from the Running Containers

~$ sudo docker container ls

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                NAMES
fe68bc38a7f9        nginx               "nginx -g 'daemon of…"   About a minute ago   Up About a minute   0.0.0.0:80->80/tcp   test2

3. Not listed from All Container

~$ sudo docker container ls -a

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                      PORTS                NAMES
866a390866d1        ubuntu              "/bin/bash"              27 seconds ago       Exited (0) 25 seconds ago                        test3

4. Forced Start the Container with positive Output

~$ sudo docker start 866

866

5. Still not show as Running after List the Containers

~$ sudo docker container ls

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
fe68bc38a7f9        nginx               "nginx -g 'daemon of…"   2 minutes ago       Up 2 minutes        0.0.0.0:80->80/tcp   test2

Any help with this issue will more than welcome community!


Extra Details About the Host OS and the Docker Version

Host OS:

Linux master 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

~$ sudo docker info

[sudo] password for master:
Containers: 3
 Running: 1
 Paused: 0
 Stopped: 2
Images: 5
Server Version: 18.06.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-142-generic
Operating System: Ubuntu 16.04.6 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.748GiB
Name: master
ID: ZRU3:Y5V2:Q2GK:AYC4:N3BX:6ADV:6BUU:47PJ:DXFC:L2MY:UVQP:TEKP
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

apl
  • 57
  • 1
  • 12

1 Answers1

0

Well, it's not an error. The ubuntu:latest default command is /bin/bash (source), so when container is up it awaits for your input. But, since you are running it in a detached mode, it can't receive input and closes it self.

From your question it is not clear what exactly do you want this container to do. But you could run it in a interactive mode with:

sudo docker container run -ti -p 81:22 --name test3 ubuntu
  • Hi **Vitally**, taking your word I'll explain what is required with this Linux container: 1. Build a Project that requires among other things a Linux Server Container. 2. The Linux Container will interact with Databases and other servers so it will require to be running 24/7, performing its actions and access via interactive shell/terminal to configure whatever is need it. 3. Question? this command will allow keeping running the container or once I **Exit** the -ti/interactive shell will terminate it? I hope this clarifies the purpose of building this Linux Container! – apl Apr 13 '20 at 12:07
  • 3. Yes it will stop the container – Vitaly Tikhoplav Apr 13 '20 at 12:49
  • Regarding to 1 and 2. All the docker community suggest to think of the containers as the single process. In your case, it seems like you need to handle multiple containers. For example, for 1 you need one container with all build dependencies that's only starts and completes the building process, after that it have to store building result somehow. In case of 2, if we are talking about processing shell input, the way i showed it's in initial the answer seems like fits you. You can even raise container on every command like `sudo docker run ubuntu /bin/bash -c "your shell command"`. – Vitaly Tikhoplav Apr 13 '20 at 12:53
  • Do it for your own responsibility: As the workaround, to make container staying idle, you could do: `docker run -d --name worker ubuntu tail -f /dev/null`. This will set container processing the endless loop. Still you will be able to execute commands or even invoke interactive shell on this container with: `docker exec -ti worker /bin/bash` – Vitaly Tikhoplav Apr 13 '20 at 13:00