Skip to content

Instantly share code, notes, and snippets.

@ericksond
Last active September 14, 2016 18:04
Show Gist options
  • Save ericksond/339c78dc0f8f6baa65a74eeb428f35c2 to your computer and use it in GitHub Desktop.
Save ericksond/339c78dc0f8f6baa65a74eeb428f35c2 to your computer and use it in GitHub Desktop.
docker
# Start a docker alpine container with exposed ports
docker run -d -p 6379:6379 redis:alpine
# Show images
docker images
# List running docker images
docker ps -a
# Inspect a docker container
docker container name
# Build a minimal docker container for Go apps
https://blog.codeship.com/building-minimal-docker-containers-for-go-applications/
# Build with C libs
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
Dockerfile
```
FROM scratch
ADD ca-certificates.crt /etc/ssl/certs/
ADD main /
CMD ["/main"]
```
# Build container
docker build -t example-scratch -f Dockerfile.scratch .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment