Skip to content

Instantly share code, notes, and snippets.

View zenthangplus's full-sized avatar
🎯
Focusing

Thang Bui zenthangplus

🎯
Focusing
View GitHub Profile
@zenthangplus
zenthangplus / fix-permission-docker-kill.sh
Created January 15, 2019 04:21
Fix permission denied when execute stop or kill docker containers on Ubuntu
#!/usr/bin/env bash
# Error example:
# ERROR: for redis cannot stop container: 16028f9:
# Cannot kill container 16028f9: unknown error after kill: docker-runc did not terminate sucessfully:
# container_linux.go:393: signaling init process caused "permission denied"
#
# This error was caused by AppArmor service in Ubuntu
# It was not working normally due to some unknown issues.
# Run following commands to fix it.
@zenthangplus
zenthangplus / rs256.sh
Last active March 17, 2024 16:26
How to generate RS256 Key Pair for Mac & Linux
#!/usr/bin/env bash
# Generate rsa keys pair
ssh-keygen -t rsa -b 4096 -f rs256.rsa
# Don't add passphrase
openssl rsa -in rs256.rsa -pubout -outform PEM -out rs256.rsa.pub
# Done
cat rs256.rsa
@michaelboke
michaelboke / Dockerfile
Last active April 23, 2024 17:50
Docker scratch x509 fix
FROM golang:alpine as builder
WORKDIR /app
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
RUN update-ca-certificates
ADD main.go /app/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -installsuffix cgo -o app .
FROM scratch
COPY --from=builder /app/app .
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/