简体   繁体   中英

Docker setup on WSL for pushing ACI containers

I'm using docker on the windows subsystem for linux, and running into issues pushing containers to azure. It seems there is more than one way to run docker in on WSL and neither works quite the way I need it to.

In both cases, I have Docker Desktop installed in Windows and set up properly for WSL usage.

Option 1: use the docker-ce package. With this option I can run docker compose locally and run my containers. However, docker login azure fails to launch a browser instance and wants to connect to local url "//azure/v2/".

Option 2: remove docker-ce and use the symlinks dropped by Docker Desktop. Here I can successfully authenticate to azure, and push a simple container, but docker compose up returns this message:

ERROR: The platform targeted with the current context is not supported.
Make sure the context in use targets a Docker Engine.

Also, this option prevents me from running the containers locally- there is no dockerd running and service docker start says dockerd doesn't exist.

Now that I'm authenticated with Azure, if I reinstall docker-ce and run docker compose up in an ACI context, I see a new error:

cannot use ACI volume, required driver is "azure_file", found ""

What is the recommended setup for Docker on WSL that will enable me to push containers to ACI and also launch them locally? What steps should I take to get the system into a clean state?

What is the recommended setup for Docker on WSL that will enable me to push containers to ACI and also launch them locally? What steps should I take to get the system into a clean state?.

Assuming you are using WSL (ubuntu 18.04 version).

Please follow thease below steps to install docker and create container locally and push to ACI as well.

Step 1: Install Docker on Ubuntu 18.04

apt install docker.io

Step 2: Pull Images from Docker Hub

docker pull nginx .

Step 3: Make local conatainer and open at port 5000(default port is 80)

docker container run -d --name nginx --publish 5000:80 nginx 

Step 4: login in azure

az login

Step 5: Created Container Registry

az acr create -g "v-rasXXXXX" -n "TestMyAcr90" --sku Basic --admin-enabled true

Step 6: Tag docker images

docker tag 605c77e624dd testmyacr90.azurecr.io/my_nginx

Where 605c77e624dd is IMAGE ID of nginx.

you can check images using cmdlet docker images .

在此处输入图像描述

Step 7: Now login into conatainer registry using docker.

docker login testmyacr90.azurecr.io

Step 8: Push docker images into container registry

docker push testmyacr90.azurecr.io/my_nginx 

Step 9: Create container Instance from Container Registry Image

az container create --resource-group v-rXXXXXdtree --name mycontainer90 --image testmyacr90.azurecr.io/my_nginx:latest --cpu 1 --memory 1 --registry-login-server testmyacr90.azurecr.io --registry-username TestMyAcr90 --registry-password CipBd5joXXXXXXfZrbw/Pl --dns-name-label testnginx5 --ports 80  

You can take reference of this thread which i have answered few month back

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM