In this dockerfile , When i build and run the image nginx is up and running but sensu-agent is not running. i need to start is manually

30 views Asked by At
`
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \
    curl jq bash  
# Install Nginx
RUN apt-get install -y nginx

# Install Sensu agent from the official repository
RUN curl -s https://packagecloud.io/install/repositories/sensu/stable/script.deb.sh | bash \
    && apt-get update && apt-get install -y sensu-go-agent

COPY agent.yaml /etc/sensu/agent.yaml

# Define environment variables for Sensu backend connection
ENV SENSU_BACKEND_URL=ws://34.207.219.74:8081
ENV SENSU_SUBSCRIPTIONS=linux,system

# Expose Nginx ports
EXPOSE 80

CMD ["/bin/bash", "-c", "nginx -g 'daemon off;' & sensu-agent start"]

`

In this dockerfile , When i build and run the image nginx is up and running but sensu-agent is not running. i need to start is manually.

1

There are 1 answers

0
Paku On

For complex entrypoint scenarios, it's useful for the entrypoint to be bash entrypoint.sh and do all your complex logix there.