1

I have a simple app built as docker image (ubuntu) and put it into docker container. It has few volumes attached to it. I want to push this container to Azure AppService Linux. I tried a few options but with no success.

  1. Azure CLI to create a web app and push container to azure container registry and then deploy that to web app.

    Gives invalid reference format error.

  2. Uploaded container to acr and updated web app container settings to load this container into web app.

    Gives image not found or invalid reference format errors.

Not sure how to proceed on this. Any help is highly appreciated. I would also like to know how to use persistent storage for volumes here. Azure fileshare is better option but not sure how to map that to container path.

Below is my sample docker-compose file.

version: "3.3"
services:
  test-backend:
    image: test-002
    container_name: test-002
    restart: always
    volumes:
     - ./assets:/opt/test_files
     - ./medialibrary:/opt/test_medialibrary
     - ./app-configs:/opt/test_configs
     - ./logs/backend:/opt/test-backend-logs
    extra_hosts:
     test-converter: "127.0.0.1"
    ports:
     - "8000:8000"
volumes:
  test-data:
  test-data2:
4
  • I am looking for solution in app service for web containers. Container instance on it's own doesn't scale and suitable for short jobs. Commented Oct 12, 2018 at 10:55
  • Do you have seen multi-container app? This is just preview version. Commented Oct 12, 2018 at 12:13
  • I have seen that but mounting volumes is the problem. Commented Oct 12, 2018 at 12:17
  • Could you set the environment variable WEBSITES_ENABLE_APP_SERVICE_STORAGE? You can take a look at this. Commented Nov 19, 2018 at 6:17

3 Answers 3

2

The image reference has to be in the format: image: server-name.azurecr.io/image-name:tag

Other than that I recommend this FAQ which helped me a lot in getting my application up and running: https://learn.microsoft.com/en-us/azure/app-service/containers/app-service-linux-faq#custom-containers

Sign up to request clarification or add additional context in comments.

Comments

1

With the destination you describe above, first you should run the image locally to check if the it is work well. You should check if the image related in the compose file is there in your local machine.

If you want to push your image to Azure Container Registry and deploy the web app from the image. You can get more details for the steps from Use a custom Docker image for Web App for Containers.

In my opinion, I suggest if you just have one service to deploy you can use the Dockerfile instead of docker compose file. It's more simple to deploy no matter the the docker image or Azure Web App service. And the docker compose is more helpful for multi services.

4 Comments

Thanks. But any idea how to mount volumes to azure app service ? i prefer to use file share. is it possible ?
unfortunately, it seem you cannot mount volume to azure app service. As I know you can mount volumes in ACI or AKS. You also can deploy the app to them.
ACI ? you mean ACS?
I mean Azure Container Instance. See Azure Container Instances.
0

Here’s how you can mount Azure Storage to your multi-container WebApp (using docker-compose.yml):

#Sample Docker Compose:
version: '3.3'
 
services:
   web:
     image: appsvc/python
     ports:
       - "8000:8000"
     volumes:
       - test:/home/site/wwwroot/test
 
volume:
     - test

Path Mapping

enter image description here

(“test” is the custom-id which we have used in the docker-compose.yml)

File Storage

enter image description here

We can now see the directories present in the storage from the webapp container:

enter image description here

https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/app-service/containers/how-to-serve-content-from-azure-storage.md

1 Comment

The answer would be more clear if the /mnt was explained. I can follow everything else related to exposing the docker volume inside of the container. The source that maps to the designated path (RIGHT side) is not clear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.