How can I launch a docker container from the command-line in MacOS?
In Debian Linux, I can execute the following commands to install docker, launch a new docker container based on the latest version of Debian, and get a shell inside that container
# securely install docker and let our user interact with it
sudo apt-get install docker.io
sudo bash -c 'gpasswd -a "${SUDO_USER}" docker'
su - `whoami`
# "securely" download and run latest Debian container
# * https://security.stackexchange.com/q/238529/213165
export DOCKER_CONTENT_TRUST=1
docker run --rm -it --entrypoint /bin/bash debian:stable-slim
In MacOS, I can (insecurely) install docker as follows
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install --cask docker
But then I get command not found
errors when attempting to run a new container (in both zsh and bash)
user@host ~ % export DOCKER_CONTENT_TRUST=1
user@host ~ % docker run --rm -it --entrypoint /bin/bash debian:stable-slim
zsh: command not found: docker
user@host ~ % bash
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ export DOCKER_CONTENT_TRUST=1
bash-3.2$ docker run --rm -it --entrypoint /bin/bash debian:stable-slim
bash: docker: command not found
bash-3.2$
Note that this is a headless machine with no access to the GUI. The only access provided is via ssh (with sudo for root permission).
How can I launch and enter a new docker container from the command-line in MacOS?
find
) and I cannot find an executable nameddocker
anywhere. Hence this question. I imagine there's some weird undocumented step that I'm missing. It's probably trivial with the GUI, but I have no idea how to proceed with only CLI.cat /proc/cpuinfo
givescat: /proc/cpuinfo: No such file or directory
. But I'm pretty sure it's Intel.