We will use minimalistic Linux distribution called Alpine (5MB)
FROM alpine:latest
RUN apk --update add redis
ENTRYPOINT ["redis-cli"]
docker build -t redis-cli .
FROM alpine:latest
RUN apk --update add postgresql-client
ENTRYPOINT ["psql"]
docker build -t psql .
Place these lines into your .bash_profile
alias psql='docker run --rm -it psql'
alias redis-cli='docker run --rm -it redis-cli'
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.