Run bash inside any version of Linux using Docker
January 08, 2019 [Docker, Tech]Docker is useful for some things, and not as useful as you think for others.
Here's something massively useful: get a throwaway bash prompt inside any version of any Linux distribution in one command:
docker run -i -t --mount "type=bind,src=$HOME/Desktop,dst=/Desktop" ubuntu:18.10 bash
This command downloads a recent Ubuntu 18.10 image, mounts my desktop as /Desktop in the container, and gives me a bash prompt. From here I can install any packages I want and then use them.
For example, today I used it to decrypt a file that was encrypted with a cipher my main OS did not have a package for.
When I exit bash, the container stops and I can find it with docker ps -a then remove it with docker rm. To really clean up I can find the downloaded images with docker image ls and remove them with docker image rm.