I am confused and couldn't find much info on this issue. I have a docker image based on ubuntu 20.4 image and runs a bunch of scripts. Using docker run locally works and the container function as it should, but Once I deploy the image to container app, I cannot see the log stream or access the console and no error. It stuck in processing state.
My docker image has CMD
and ENTRYPOINT
setup like this:
ENTRYPOINT ["./start_script.sh"]
CMD [ "sleep", "infinity" ]
I have included the container app command like
command = ["/bin/bash","-c","./start_script.sh"]
Any idea what I am missing ? I will appreciate.
Below is the docker file
# Use Ubuntu 20.04 LTS as the base image
FROM ubuntu:20.04
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Update apt repositories and install necessary packages
RUN apt-get update && apt-get install -y \
software-properties-common \
curl \
lsb-release \
gnupg \
python3-pip
RUN python3 -m pip install pip --upgrade \
&& pip install pyopenssl --upgrade
# Install Certbot
RUN apt-get install -y certbot
# Install certbot-dns-azure plugin via pip
RUN pip3 install certbot-dns-azure
# Install cron
RUN apt-get install -y cron
# Install Azure CLI
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a directory for scripts and the credentials file
WORKDIR /app
# Copy your scripts and credentials file into the image
COPY start_script.sh combine_and_upload.sh renew_script.sh azure_credentials.ini ./
# Set the appropriate permissions for the credentials file and make scripts executable
RUN chmod 600 azure_credentials.ini \
&& chmod +x start_script.sh combine_and_upload.sh renew_script.sh
# Set the entry point to your start script
ENTRYPOINT ["./start_script.sh"]
CMD [ "sleep", "infinity" ]
I run it locally as like:
run -d --name certbot-container -e KEYVAULT_NAME=xxx -e CERT_KEY_NAME=xxx -e DEVOPS_EMAIL=xxx -e DOMAIN=xxx -e AZURE_TENANT_DOMAIN=xxx -e CERT_NAME=xxxx registry.xxx/xxx/xx/services/certbot:v1
Container App Terrform Setup snippet:
containers = [
{
image = "registry.xxx/xxx/xx/services/certbot:v1"
command = [
"/bin/bash",
"-c",
"./start_script.sh"
]
env = [
{
name = "KEYVAULT_NAME"
value = azurerm_key_vault.clmDepKeyVault.name
},
{
name = "CERT_KEY_NAME"
value = var.sslCertificateAndKeyName
},
{
name = "DEVOPS_EMAIL"
value = var.devopsEmail
},
{
name = "DOMAIN"
value = var.clmDomainName
},
{
name = "AZURE_TENANT_DOMAIN"
value = var.TenantDomainName
},
{
name = "CERT_NAME"
value = var.certbotKeyVaultCertificateName
}
]
name = "certbot"
resources = {
cpu = 0.5
memory = "1Gi"
},
volumeMounts = [
{
mountPath = "/app"
volumeName = "azure-credentials"
},
{
mountPath = "/etc/letsencrypt"
subPath = "/proxy/certbot"
volumeName = "certbot-volume"
}
]
}
I guess as your docker run
command to execute isn't taking any additional arguments(nothing after image name)
So you should just remove this part from your Tarraform file
command = [
"/bin/bash",
"-c",
"./start_script.sh"
]
And everything should work