How To Create Container Images for Azure Container Service (ACS)

If you have come across Azure Container Service (ACS) you need to know that it’s a useful service that allows users to host containerized system components without worrying about the high cost of management. To simplify the process of creating and using Dockers containers, Azure offers the ACS which helps to host Docker containers in the cloud. It’s also an essential service that allows optimal configuration of an open-sourced orchestration tools such as Docker Swarm and DC/OS.

In this article, we look at how to use Docker to create images, then push these images to Azure Container Service (ACS).

If you haven’t installed the Docker client on your system, start by installing it by visiting the link Copy the file named “docker.exe” located in the “docker” subdirectory.


You will need the following to create a container image for ACS.

  • A Microsoft Azure active subscription.
  • Docker client for macOS, Windows, or Linux.
  • PuTTY for Window users only.

Step 1: Create an application

If you’re using a Mac Os or Linux open, a new window. For Windows, open a command prompt window and go to the “resources” directory. The section features a list of files that will be used to build a container image.

Among the content in this directory is a file labeled “Dockerfile” where Docker is stored. This will be used to create your image. You will also find a Python script written as as well as the “input” and “output” subdirectories.

To command the Docker client to send information to the localhost in the Azure Container Service, run the commands below.

For MacOS or Linux:

export DOCKER_HOST=tcp://

For windows:

set DOCKER_HOST=tcp://

The above command uses port 2375 because Docker Swarm pays attention to it.

In the “resources” directory, run the command below to start creating your container image in the “Ubuntu-convert” directory. It’s the same file where Python script and other subdirectories are stored. Type the details of the file at the end of your command:

docker build --no-cache --tag ubuntu-convert

The command may take a while to complete. Then go ahead and run the next command to start listing all the images present. Ensure “ubuntu-convert” is in the list of images:

docker images

Step 2: Run the Container Image

Using the command below, run the container image and label it as "acslab:"

docker run -dit --name acslab ubuntu-convert /bin/bash

Once the container starts running, execute your Python script. To do so, run the command below:

docker exec -it acslab /

If the command above runs successfully, the result subdirectory should show JPG files in form of grayscale versions in the “input” directory. To copy the “output’” files in the subdirectory from the container image files to your machine, type the command below:

docker cp acslab:/output

To stop the process, run the command below:

docker stop acslab

To remove the  "acslab" container, run the command below:

Now, go to the “resources” subdirectory and list the details in the “output” directory to verify they are about eight image files extracted from the Azure container.

To confirm this, open one of the image files with a grayscale image.


There you have it. You have created a Docker image and successfully run it in Azure Container Service. Now you can close the terminal window for macOS and Linux or command prompt for Windows since the process is complete. We hope this tutorial was helpful.

Check out these top 3 Best web hosting services

Was this article helpful?