Monday, October 4, 2021

Pushing new docker images to Azure ACR

1. Create a hello world program (Optional).

curl http://timelessname.com/elfbin/helloworld.tar.gz --output helloworld.tar.gz

mkdir helloworld

tar -xvf helloworld.tar.gz -C ./helloworld

cd helloworld/

./hello


2. Create a docker file

FROM scratch
COPY hello /
CMD ["/hello"]

3. Build docker:

docker build --tag hello .

4. Verify it can start:

docker run --rm hello

5. Login to ACR:

az login
az acr login --name <yourrepo>.azurecr.io

6. Rename your docker and push:

docker tag hello <yourrepo>.azurecr.io/samples/helloworld:v1
docker push <yourrepo>.azurecr.io/samples/helloworld:v1


6. Login interactively to container


a running container: docker exec -it <container-name-or-id> bash
run a container: docker run --entrypoint /bin/bash -it <image>

No comments:

Post a Comment