1

I've been trying to get two containers of a single image started up, however when I am unable to attach to the second container.

Here's what I've got so far.

[]#docker image ls

gives me the one image I have, docker.io/centos

[]#docker container ls -a

Shows my first container, with the proper image name, status exited, command of "/bin/bash"

I can start this container fine with []#docker container start -ai container0 This opens it on my console and everything is peachy.

The problem starts when I create another container with the same image.

[]#docker container create docker.io/centos
bc342cb83cc1284e594c3f5ee[etc...]
[]#docker container start -ai bc342cb83
[]#

It just goes back to the normal console. Starting container0 still works normally.

[]#docker container start -ai container0
;@container0:/[root@container0 /]#
UpTide
  • 236
  • 1
  • 9

1 Answers1

1

I don't think you're doing it right...

[alexus@wcmisdlin02 ~]$ docker pull nginx
Using default tag: latest
Trying to pull repository docker.io/library/nginx ... 
latest: Pulling from docker.io/library/nginx
683abbb4ea60: Pull complete 
a470862432e2: Pull complete 
977375e58a31: Pull complete 
Digest: sha256:a65beb8c90a08b22a9ff6a219c2f363e16c477b6d610da28fe9cba37c2c3a2ac
Status: Downloaded newer image for docker.io/nginx:latest
[alexus@wcmisdlin02 ~]$ docker run -d nginx
45b6daf507a37a713ed9619931e85c5e31bc17093f85d43017e98545e8d80b0c
[alexus@wcmisdlin02 ~]$ docker run -d nginx
fb57c1a1b541de6e6136b912e14af86cfbefff5e2f4d347a1819e8cc5a701903
[alexus@wcmisdlin02 ~]$ docker run -d nginx
3e343317bc4f5502647c1c2d5f34d00339cf9eb82bc95b6ff40a5d543fe4210c
[alexus@wcmisdlin02 ~]$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
3e343317bc4f        nginx               "nginx -g 'daemon ..."   2 seconds ago       Up 1 second         80/tcp              youthful_jennings
fb57c1a1b541        nginx               "nginx -g 'daemon ..."   4 seconds ago       Up 2 seconds        80/tcp              zen_cray
45b6daf507a3        nginx               "nginx -g 'daemon ..."   5 seconds ago       Up 3 seconds        80/tcp              laughing_raman
[alexus@wcmisdlin02 ~]$ 
alexus
  • 13,112
  • 32
  • 117
  • 174
  • yeah... I'm in the process of writing my containers to images and doing pretty much your example. Once it's done I'll come back and delete this question since it's just me not using docker the right way. – UpTide Jul 11 '18 at 15:19
  • *OR* you can just mark my answer as a correct answer and let other users to learn from your experience) – alexus Jul 11 '18 at 15:35
  • 1
    honestly i figured i would lose at least 3 rep on this question, so i guess it's more helpful than i thought – UpTide Jul 11 '18 at 16:01
  • deleting questions wont raise your reps, user find your question useful and upvote your question will increase your rep... make sure you're within guide lines and you'll be ok) – alexus Jul 11 '18 at 16:26