0

After building my container image with a Containerfile I try to run the container and it doesn't start and the exit code is 0. I'm not sure what I'm doing wrong. I'm trying to download a simple image and run it but it won't run or give me an error code.

Here is my Containerfile:

'''

FROM ubi8/ubi:8.5
MAINTAINER john
LABEL com.redhat.component="ubi8-container" \
  name="ubi8" \
  version="8.6"
ENV container oci
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

This is the command I use to create the image

podman build --tag ubi-tools -f Containerfile-net-tools

This is the command I use to start the container

podman run -d --name tools-1 localhost/ubi-tools

This is the output

root@centos-main container_files]# podman ps -a
CONTAINER ID  IMAGE                       COMMAND    CREATED        STATUS                          PORTS  NAMES 
540245ebf9b5  localhost/ubi-tools:latest  /bin/bash  4 seconds ago  Exited (0) 3     seconds ago         tools-1
John
  • 125
  • 2
  • 10
  • 1
    A Docker container is a wrapper around a single process; what is the `CMD` you want the container to run? It doesn't look like you're really installing anything in the image, does [Docker container will automatically stop after "docker run -d"](https://stackoverflow.com/questions/30209776/docker-container-will-automatically-stop-after-docker-run-d) describe your situation? – David Maze Sep 28 '22 at 16:30
  • ah that makes sense! I actually did not want to run any specific command but just have access to the /bin/bash so I can work in the environment and further enhance the container with tools I installed and script development. I guess I'm treating it like a virtual machine more than a process like CMD httpd when I run those containers they work fine. – John Sep 28 '22 at 20:04

0 Answers0