Getting started with Docker

aah CLI provides command to generate Dockerfile for development and production purpose. aah provides very good starter Dockerfile(s) for your application, enhance it per your use case.

Ensure to install Docker on your machine.

Note: Since v0.12.0 aah does not provide docker images aahframework/aah:* in-favor of Go modules.

Table of Contents

Handy generate Command

Introduced in v0.10.0 aah CLI. Command generate is to help developer(s) in their application development path. It generates two docker files -

  • - For development purpose.
  • - Uses Multistage-build to create very tiny docker image for production purpose.


# Go to application base directory and run
aah generate script --name docker

# OR shorthand
aah g s -n docker

Using Dockerfile.{dev, prod}

Various sample usage commands.

To Build Docker Image

# Using
docker build --no-cache -t "your-app-image-name:dev" -f .

# Using
docker build --no-cache -t "your-app-image-name:latest" -f .

Running built Docker Image

# Run docker image created using ``
# To stop: press Ctrl + C
docker run -it -p 8080:8080 "your-app-image-name:dev" aah run

# Run docker image created using ``
# To stop: do it via container stop
docker run -p 8080:8080 "your-app-image-name:latest"