Skip to content

Instantly share code, notes, and snippets.

@joubertredrat
Forked from petrkohut/howto.md
Created June 12, 2020 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joubertredrat/e63cbc164a3cb350c5bd889256b82d0c to your computer and use it in GitHub Desktop.
Save joubertredrat/e63cbc164a3cb350c5bd889256b82d0c to your computer and use it in GitHub Desktop.
How to have redis-cli and psql installed on machine using Docker

How to install redis-cli and psql client on your machine with Docker

Preparing docker images

We will use minimalistic Linux distribution called Alpine (5MB)

Dockerfile of redis-cli

FROM alpine:latest
RUN apk --update add redis

ENTRYPOINT ["redis-cli"]

Creating redis-cli docker image (~7MB)

docker build -t redis-cli .

Dockerfile of psql client

FROM alpine:latest
RUN apk --update add postgresql-client

ENTRYPOINT ["psql"]

Creating psql docker image (~7MB)

docker build -t psql .

Add aliases into our ~/.bash_profile

Place these lines into your .bash_profile

alias psql='docker run --rm -it psql'
alias redis-cli='docker run --rm -it redis-cli'

Restart your terminal and that's it

You can test it by running this:

redis-cli --help
psql --help

Bear in mind that dotfiles (rc files) will not work with this configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment