Mostrando postagens com marcador Docker. Mostrar todas as postagens
Mostrando postagens com marcador Docker. Mostrar todas as postagens

terça-feira, maio 09, 2023

Deploy multi-container app using Docker Compose

This is a quick post about how to deploy a multi-container app into Azure Container Instances:

    Log in to Azure (I have access to several tenants, so it makes sense to pass the tenant ID as a parameter):

#docker login azure --tenant-id "yourtenant"

    Create a Docker context (select the subscription and resource group):

#docker context create aci mycontext

    If you have more than one context, you can select it using the command below:

#docker context use "yourcontext"

    Check the current context:

#docker context show

    Deploy your Docker Compose:

#docker compose up

Tip:

Below is the code that you must add to your Docker Compose file if you need an external volume (Azure Files). This code mounts a volume on /opt/test.

services:
  myservice:
    container_name: mycontainer
    image: xxxxxx:latest   
    volumes:
      - storagevolume:/opt/test
volumes:
  storagevolume:
    driver: azure_file
    driver_opts:
      share_name: share
      storage_account_name: accountname
      storage_account_key: "XXXXXXXX=="


sábado, janeiro 29, 2022

Docker CLI and Azure ACI

I know, there are several good articles about how we can use docker CLI to deploy our workload to Azure ACI. I like to write short articles, it helps me understand the technology.

You can find a good documentation regarding ACI here.

I will deploy a Multi Container application using a docker compose command. Let's do it!

First, Login on Azure using

$docker login azure

Tip: You can use --tenant-id to connect to a specific Azure tenant.

Create a docker context, on my example the name is acideployblog, you need to select the subscription, resource group.

$docker context create aci acideployblog

 

You will get:

Successfully created aci context "acideployblog"

 You can list the docker context with the command

$docker context list

To set the default context

$docker context use acideployblog

To show the current context

$docker context show

Important, you must log in to your Azure Container Registry

$az acr login --name mycontainerregistry

One the directory that I have my docker compose file I run:

$docker compose --file docker-compose.staging.yml --project-name myproject-server-staging u

If you don't put a --project-name the name of your container will be derived from the working directory.

If everything goes right your container group will be create:

 

You can check the container execution list with the command

$docker ps

sábado, dezembro 18, 2021

Docker Commands

Some docker commands for reference:

Commands:

# List images
docker images

# Run a docker
docker run imageID

# List the docker container that is running
docker ps

# Check the docker IP
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ContainerID

# Build a docker (look for a docker file)
docker build .

# Tag your local image image
docker tag ImageID name

# Tag to Remote repository (node17 repository)
docker tag node17 myr.azurecr.io/node17

# Push to remote Azure container registry (node17 repository)
docker push myr.azurecr.io/node17

# Delete all containers
docker rm $(docker ps -a -q) 
 
# Delete all images
docker rmi $(docker images -a -q)
 


quinta-feira, agosto 05, 2021

Push the image to Azure Container registry

The goal is to push an image to Azure Container registry.

Docker pull to my local machine:

>docker pull prismagraphql/prisma:1.34.8

 Check the images

 

Login on my Container registry

>docker login myregistry.azurecr.io

 Tag your image

>docker tag prismagraphql/prisma:1.34.8 myregistry.azurecr.io/prismagraphql/prisma:1.34.8

 

 Final Step is push

>docker push myregistry.azurecr.io/prismagraphqa/prisma:1.34.8

 

 Now, if you take a look you will see the repository