Amazon Linux 2 container for local testing and building of Go binaries for Lambda or EC2 instances
357
Latest Update (10-02-2023) (dd-mm-yyyy):

ARM64 build of Amazon Linux 2, Updated with a few extras for general use and built specifically for testing/building Go applications on a local EC2(esque) system.
Is really useful for building binaries for lambda to ensure compatibilities.
For my specific use case, if a Go project needs CGO_ENABLED=1 set this can cause a world of pain on Lambda, however by binding a working directory to this container and running 'go build...' in here you can ensure a perfectly working binary for upload to AWS Lambda. Of course in production you would have a nice build chain with GitHub actions or similar but this is great for initial testing and building.
Launch interactive terminal and map Go project folder:
docker run -it -v /path-to-/my-go/projects/:/extdata --name Amazon-Linux-Workstation samuelbanks/amazonlinux-2-workstation:latest /bin/zsh
This will now drop you directly into a terminal with a folder mapped to your project(s), from here you can now build / test etc.
Once you have run the above command once you can simply get the CONTAINER ID by running docker container ls -a (in a new terminal, not the Amazon Linux Instance) then in the future you can just run
docker exec -it DOCKERID /bin/zsh (replace DOCKERID with the actual id usually looks something like f85dd45f4dd), obviously if the container is not running (say after a reboot) run docker start DOCKERID first
Content type
Image
Digest
sha256:9431d6ae6…
Size
725.5 MB
Last updated
over 3 years ago
docker pull samuelbanks/amazonlinux-2-workstation