Score:1

Can not run redhat/ubi8 latest via docker run command

ky flag

I am trying to run redhat/ubi8.

docker pull redhat/ubi8
docker run redhat/ubi8

The docker run command returns with no output.

The docker container list command lists the container:

71b0897317aa redhat/ubi8:latest "/bin/bash" 21 minutes ago Exited (0) 21 minutes ago amazing_volhard

Trying to get the log with docker logs amazing_volhard gives no output.

Some additional diagnostics facts:

  • The weirdest thing, I can successfully run this very image using Docker Desktop, via just clicking run. The running container seems to be working, however also outputs zero line to the log.
  • I can also successfully run other linux images via command line docker run for example cassandra:latest, or docker run -d -p 80:80 docker/getting-started all successfully writing to the log

Question

Although I understand redhat/ubi8 is a base image which's purpose to build my own custom images on it, still would like to understand, why I can not run it with docker run while I can run it via Docker Desktop GUI, and I also would like to understand why the log is empty for both the successfully started container, and the unsuccessfully started container.

Score:3
pt flag

Like many base images, redhat/ubi8 runs a shell by default (/bin/bash in this case, but it doesn't really matter).

If you run bash and standard input is closed, it exits immediately. You can see that same behavior if you run something like:

bash < /dev/null

Because you're executing docker run without specifying -i, that's exactly what's happening here:

  1. You run docker run redhat/ubi8
  2. The redhat/ubi8 image runs /bin/bash
  3. /bin/bash sees that stdin is closed, so it exits

If you want to see different behavior, either add -i and -t to your command line:

docker run -it redhat/ubi8

Or run something other than a shell:

docker run redhat/ubi8 sleep inf
ky flag
many thx, clear now..
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.