Docker Shell aliases

Rico recommends adding the dr alias for working with Docker. Here's an example you can add to your .bashrc or .zshrc:

# [D]ocker [r]un as a task
alias dr="docker-compose run --rm web"

# [D]ocker [j]un as a [s]erver
alias drs="docker-compose run --rm --service-ports web"

# Up
alias dcu="docker-compose up"

What does it do?

The dr command will run a task in a Docker container. Think of it just like heroku run.

dr bash            # opens a shell
dr mix test        # runs tests (elixir)
dr yarn --force    # force installs yarn dependencies

The drs command runs servers, which will open ports. Use it for running servers:

drs iex -S mix phx.server   # phoenix
drs rails s                 # rails

The dcu command is just a shorthand for docker-compose up. This will launch your server. Think of this as the "one simple way to start any project."

dcu       # Up the server (and show logs)
dcu -d    # Up the server, [d]etached in the background