This is my first time using azure, I made a Pipeline in DevOps that creates images from dockerfile and pushes them to my ACR. Then I created a multi-container web app use docker-compose and connected my ACR to the web app. But the web app can't pull the images from the ACR. I don't know what I am doing wrong.
I am getting errors when I try to pull images from ACR in multi container web app.
Errors:
2019-11-28 19:27:46.755 INFO - Pulling image: [registry-name].azurecr.io/server
2019-11-28 19:27:46.921 ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"manifest for [registry-name].azurecr.io/server:latest not found: manifest unknown: manifest unknown"}
Docker-compose config:
version: "3"
services:
# SERVER CONTAINER
server:
image: [registry-name].azurecr.io/server
expose:
- 4000
ports:
- 4000:4000
command: node src/server.js
restart: always
# CLIENT CONTAINER
client:
image: [registry-name].azurecr.io/client
ports:
- "80:80"
- "443:443"
links:
- server
depends_on:
- server
restart: unless-stopped
First of all, the error shows that it cannot find the [registry-name].azurecr.io/server image with latest tag. So if your image does exist, then the problem is the tag.
If you do not add the tag for your image, it will pull the latest tag in default generally. The logs show like this:
But add a special tag for the image is better than no tag. If you want to get the latest image from the ACR, then always add the latest tag when push the image, do the same when you use that image.
Related
I have Azure Container Registry
xxxxxxxx.azurecr.io
Inside of it I have 1 image
learning-docker01/api
Next, I create App Service. I select Docker Container as publish option and following options:
Options: - Docker Compose (Preview)
Image Source - Azure Container Registry
Registry - xxxxxxxx
Next I select my docker-compose.yaml file. The configuration looks like this:
version: "3.4"
services:
docker001.api:
image: xxxxxxxx.azurecr.io/learning-docker01/api
build:
context: ./Docker001.API
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:80
ports:
- "8000:80"
mongo:
image: mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=root
- MONGO_INITDB_DATABASE=docker
ports:
- 27017:27017
Then I hit Review & Create and everything deploys smoothly.
The problem - after deployment, if I view Log Stream (Preview) I see the following Errors:
DockerApiException: Docker API responded with status code=InternalServerError,
response={"message":"Get https://registry-1.docker.io/v2/library/mongo/manifests/latest:
unauthorized: incorrect username or password"}
----
Pulling docker image mongo failed:
---
Container for learningdocker001_mongo_0_986c7f1a site learningdocker001 is unhealthy, Stopping site.
I'm not sure what the problem is. Everything runs fine locally. On Azure docker001.api service runs but mongo service doesn't.
You need to set up authentication to allow the App Service to pull images from the ACR.
Recommended way is to use the Managed Identity. Detailed setup description here: https://learn.microsoft.com/en-us/azure/app-service/tutorial-custom-container?pivots=container-linux#configure-app-service-to-deploy-the-image-from-the-registry
docker compose-up locally is able to build and bring up the services, but when doing the same on Azure Container Instances I get the below error
containerinstance.ContainerGroupsClient#CreateOrUpdate: Failure
sending request: StatusCode=400 -- Original Error:
Code="InaccessibleImage" Message="The image
'docker/aci-hostnames-sidecar:1.0' in container group 'djangodeploy'
is not accessible. Please check the image and registry credential."
Also, what is the purpose of this image docker/aci-hostnames-sidecar
The ACI deployment was working fine and now suddenly it doesn't work anymore
The docker-compose.yml contents are provided below
version: '3.7'
services:
django-gunicorn:
image: oasisdatacr.azurecr.io/oasis_django:latest
env_file:
- .env
build:
context: .
command: >
sh -c "
python3 manage.py makemigrations &&
python3 manage.py migrate &&
python3 manage.py wait_for_db &&
python3 manage.py runserver 0:8000"
ports:
- "8000:8000"
celery-worker:
image: oasisdatacr.azurecr.io/oasis_django_celery_worker:latest
restart: always
build:
context: .
command: celery -A oasis worker -l INFO
env_file:
- .env
depends_on:
- django-gunicorn
celery-beat:
image: oasisdatacr.azurecr.io/oasis_django_celery_beat:latest
build:
context: .
command: celery -A oasis beat -l INFO
env_file:
- .env
depends_on:
- django-gunicorn
- celery-worker
UPDATE There might have been some issue from Azure end as I was able to deploy the containers as I usually do without any changes whatsoever
When you use the docker-compose to deploy multiple containers to ACI, firstly you need to build the images locally, and then you need to push the images to the ACR through the command docker-compose push, of course, you need to log in to your ACR first. See the example here.
And if you already push the images to your ACR, then you need to make sure if you log in to your ACR with the right credential and the image name with the tag is absolutely right.
I'm trying to deploy a docker compose file to Azure Container Instances (ACI) using public Dockerhub images with these two tutorials, docker, youtube. However, it keeps saying I can't pull a public dockerhub image
containerinstance.ContainerGroupsClient#CreateOrUpdate:
Failure sending request: StatusCode=400 -- Original Error: Code="MultipleErrorsOccurred"
Message="Multiple error occurred:
'BadRequest':'InaccessibleImage':'The image 'selenium/standalone-firefox:latest' in container group 'test_ui_automation' is not accessible. Please check the image and registry credential.
The process itself should be when an ACI instance gets setup so there's no register details existing and the image is public on docker hub.
I've logged into Azure and Docker Hub. Based on the youtube tutorial, it should just be a process of creating an ACI instance, then running docker compose -f azure-testproject-docker.yaml -d.
azure-testproject-docker.yaml
version: '3.1'
services:
testproject-agent:
image: testproject/agent:latest
container_name: testproject-agent
depends_on:
- chrome
- firefox
volumes:
- mydata:/var/testproject/agent
environment:
TP_AGENT_ALIAS: "MY DOCKER AGENT"
TP_API_KEY: "MY KEY"
TP_JOB_PARAMS: '"jobParameters" : { "browsers": [ "chrome", "firefox" ] }'
CHROME: "chrome:4444"
FIREFOX: "firefox:4444"
chrome:
image: selenium/standalone-chrome:latest
volumes:
- mydata:/dev/shm
firefox:
image: selenium/standalone-firefox:latest
volumes:
- mydata:/dev/shm
volumes:
mydata:
driver: azure_file
driver_opts:
share_name: myfileshare
storage_account_name: mystorageaccount
The docker-compose file is quite basic, just used TestProject's default docker compose file. The images download on local docker, but the azure part doesn't work.
The whole point was to deploy with only a Docker Compose file, no Dockerfile as it's just using public dockerhub images.
Has anyone experienced a similar issue?
Solution
Remove container_name as not supported in ACI
Turns out the issue was simply due to container_name not being supported.
As per comment by andriy-bilous
First you should look at supported ACI docker-compose features, as at least container_name is not supported. docs.docker.com/cloud/aci-compose-features – Andriy Bilous 17 hours ago
Resolved the issue just by removing the container_name line.
I'm trying to get the X-Ms-Client-Principal-Name value from the request header but it doesn't come anymore after I change the container settings from Single Container to Docker Compose.
Any idea why is this happening?
This is the docker-compose file that I'm using:
version: "3.8"
services:
web:
image: webimage:v1.0.0
ports:
- "8000:80"
redis:
image: redis:alpine
Both images are correctly downloaded from the repository and launched
I'm trying to run KrakenD image in Azure App Service.
KrakenD requires json config file krakend.json to be put into /etc/krakend/ (KrakenD image is based on Linux Alpine)
I created Web App for containers with the following docker-compose file:
version: "3"
services:
krakend:
image: devopsfaith/krakend:latest
volumes:
- ${WEBAPP_STORAGE_HOME}/site/krakend:/etc/krakend
ports:
- "8080:8080"
restart: always
Added storage account with a blob container where uploaded sample kraken.json file
In app configuration i added a path mapping like this:
But it looks like volume was not mounted correctly
2019-11-15 12:46:29.368 ERROR - Container create failed for
krakend_krakend_0_3032a936 with System.AggregateException, One or
more errors occurred. (Docker API responded with status
code=InternalServerError, response={"message":"invalid volume
specification: ':/etc/krakend'"} ) (Docker API responded with status
code=InternalServerError, response={"message":"invalid volume
specification: ':/etc/krakend'"} ) InnerException:
Docker.DotNet.DockerApiException, Docker API responded with status
code=InternalServerError, response={"message":"invalid volume
specification: ':/etc/krakend'"}
2019-11-15 12:46:29.369 ERROR - multi-container unit was not started
successfully
Additional questions
What does mean Mount path in Storage mounting? - i put there value /krankend
volume definition starts with ${WEBAPP_STORAGE_HOME} in docs they specified it as
volumes:
- ${WEBAPP_STORAGE_HOME}/site/wwwroot:/var/www/html
so i did it by analogy and tried all 3 possible paths
${WEBAPP_STORAGE_HOME}/site/wwwroot/krakend
${WEBAPP_STORAGE_HOME}/site/krakend
${WEBAPP_STORAGE_HOME}/krakend
but no luck - still getting the error
ERROR parsing the configuration file: '/etc/krakend/krakend.json'
(open): no such file or directory
finally resolved that with the following docker-compose file
version: "3"
services:
krakend:
image: devopsfaith/krakend:latest
volumes:
- volume1:/etc/krakend
environment:
WEBSITES_ENABLE_APP_SERVICE_STORAGE: TRUE
ports:
- "8080:8080"
restart: always
where volume1 is a blob storage mounted as the following
This did not work for me. I was getting Bind mount must start with ${WEBAPP_STORAGE_HOME}.
This worked. docker-compose.yml
version: "3"
services:
backend:
image: xxxx
ports:
- 80:80
volumes:
- vol1:/var/www/html/public
volumes:
vol1:
driver: local
Volume definition:
Name: vol1
Config: basic
Storage accounts: ...
Storage container: ...
Mount paht: /var/www/html/public