Skip to content

Instantly share code, notes, and snippets.

🎯
DockerCon LIVE 2020 is coming!

Bret Fisher BretFisher

🎯
DockerCon LIVE 2020 is coming!
View GitHub Profile
@BretFisher
BretFisher / docker-for-mac.md
Last active Jun 29, 2020
Getting a Shell in the Docker for Mac Moby VM
View docker-for-mac.md

2018 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@BretFisher
BretFisher / pcat-install.sh
Last active Jun 28, 2020
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
View pcat-install.sh
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
@BretFisher
BretFisher / Dockerfile
Last active Jun 26, 2020
WIP sample Laravel php_fpm plus nginx plus supervisor Docker setup with npm, composer, bower, and more
View Dockerfile
FROM yourdockername/base-php-nginx:latest AS build
# BUILD STAGE
# the primary reason we have two build stages is so SSH key of private repo's will never
# be in final image
# COPY IN BUILD SSH KEY
# It won't be copied to final image
# add this build arg to compose file
ARG BUILDKEY
RUN if [ -z "$BUILDKEY" ]; then echo "BUILDKEY SSH NOT SET - ERROR"; exit 1; else : ; fi
@BretFisher
BretFisher / docker-swarm-ports.md
Last active Jun 25, 2020
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables
View docker-swarm-ports.md

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example

@BretFisher
BretFisher / docker-cli-tips-and-tricks.md
Last active Jun 20, 2020
Docker CLI Tips and Tricks
View docker-cli-tips-and-tricks.md
@BretFisher
BretFisher / .travis.yml
Created Feb 15, 2016
Travis-CI Docker Image Build and Push to AWS ECR
View .travis.yml
sudo: required #is required to use docker service in travis
language: php #can be any language, just php for example
services:
- docker # required, but travis uses older version of docker :(
install:
- echo "install nothing!" # put your normal pre-testing installs here
@BretFisher
BretFisher / present.zsh-theme
Last active Jun 3, 2020
oh-my-zsh theme for presentations (hides prompt features based on path)
View present.zsh-theme
# problem: when presenting, I want to obscure
# my prompt to act like it's at root of file system
# and be very basic with no git info, etc.
# solution: this theme lets you set a ENV to the path
# of your presentation, which will help remove unneeded prompt
# features while in that path
# oh-my-zsh theme for presenting demos
# based off the default rubbyrussell theme
@BretFisher
BretFisher / docker-for-windows.md
Last active May 30, 2020
Getting a Shell in the Docker for Windows Moby VM
View docker-for-windows.md

2018 Update: Easiest option is Justin's repo and image

Just run this from your CLI and it'll drop you in a container with full permissions on the Moby VM. Only works for Moby Linux VM (doesn't work for Windows Containers). Note this also works on Docker for Mac.

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1

@BretFisher
BretFisher / README.md
Last active May 22, 2020
Simple Apache + Nginx Reverse Proxy Example in Docker Compose
View README.md
  1. download these two files to the same directory
  2. docker-compose up
  3. http://localhost should show you "it works" which is apache being reverse-proxied through nginx
  4. docker sets up DNS for web based on compose service name so the nginx front-end can find http://web
  5. proxy is set to listen on public port 80 on host so it'll receive incoming traffic, then push to httpd
@BretFisher
BretFisher / gruvbox-light.js
Last active May 17, 2020 — forked from anhari/gist:23ae031e93e2f465258439cb6802acad
gruvbox *light* blink shell theme
View gruvbox-light.js
black = '#fbf1c7';
red = '#cc241d'; // red
green = '#98971a'; // green
yellow = '#d79921'; // yellow
blue = '#458588'; // blue
magenta = '#b16286'; // pink
cyan = '#689d6a'; // cyan
white = '#7c6f64'; // light gray
lightBlack = '#928374'; // medium gray
lightRed = '#9d0006'; // red
You can’t perform that action at this time.