Docker .NET Container Restarting

0

Firstly, I would like to declare that I am a sophomore at Docker and Software world. Our system consists of CentOS 7 and Docker. We installed Docker and create some containers using dockercompose such as rabbitMQ, Jenkins and.NET. But we have some problem with our container. My .NET container status is always ‘Restarting’ as you can see pictures that I share above. Is this a problem? Do you have any idea about whether this is a problem or not?

I am sharing my docker compose file

version: "3.3"
rabbitmq3:
  container_name: "con_rabbitmq"
  image: rabbitmq:3.8-management-alpine
  restart: always
  ports:
      # AMQP protocol port
      - '7001:5672'
      # HTTP management UI
      - '7000:15672'
  networks:
  - backend


jenkins:
image: jenkins/jenkins:lts
privileged: true
restart: always
user: root
ports:
  - 8090:8080
  - 50000:50000
container_name: "con_jenkins"
volumes:
  - ~/jenkins:/var/jenkins_home
  - /var/run/docker.sock:/var/run/docker.sock
  - /usr/local/bin/docker:/usr/local/bin/docker
healthcheck:
    test: ["CMD", "curl", "f", "http://app-ffetest.ekol.com"]
    interval: 5s
    timeout: 5s
    retries: 3
networks: 
  - backend


dotnet:
image: mcr.microsoft.com/dotnet/sdk:6.0
privileged: true
restart: always
user: root
ports:
  - 8000:80
container_name: "con_dotnet" 
networks: 
  - backend

Your shared picture shows that you just run bash in a container. Don’t expect bash to run and wait. It will run and terminate without running it in internactive mode. Run an other process in the container like “sleep inf” if you really don’t have anything else and just want to keep that container alive to have a forever running client where you work interactively. Even if you run that sleep process, you should ask for an init process, otherwise when you want to sop your container, it will not answer and after tha 10 seconds timeout, it will be “killed”.

Try this:

dotnet:
  image: mcr.microsoft.com/dotnet/sdk:6.0
  privileged: true
  restart: always
  user: root
  ports:
    - 8000:80
  container_name: "con_dotnet"
  networks: 
    - backend
  command:
    - sleep
    - inf
  init: true

Are you sure you need a privileged container?

To be honest, I don’t have enough knowledge and information docker. I have found this file and modified it. I can remove the privileged line. Okay, I will try it. Thank you so much for your contribution to my problem.