Title: Getting started with Docker for your aah application Desc: Getting started with Docker for your aah application. Keywords: docker, container, aah, application
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
Introduced in v0.10.0 aah CLI. Command generate
is to help developer(s) in their application development path. It generates two
docker files -
Dockerfile.dev
- For development purpose.Dockerfile.prod
- Uses Multistage-build to create verytiny
docker image for production purpose.
# Go to application base directory and run
aah generate script --name docker
# OR shorthand
aah g s -n docker
Various sample usage commands.
# Using Dockerfile.dev
docker build --no-cache -t "your-app-image-name:dev" -f Dockerfile.dev .
# Using Dockerfile.prod
docker build --no-cache -t "your-app-image-name:latest" -f Dockerfile.prod .
# Run docker image created using `Dockerfile.dev`
# To stop: press Ctrl + C
docker run -it -p 8080:8080 "your-app-image-name:dev" aah run
# Run docker image created using `Dockerfile.prod`
# To stop: do it via container stop
docker run -p 8080:8080 "your-app-image-name:latest"