I'm using a Mac, but I want to learn and use Ubuntu for development and I don't care about the GUI. I used to use Vagrant and ssh to the machine, but it consumes much of my machine resources. Can I use docker for the same purpose while also having the isolation (when I mess things up) of a VM?
The answer is "Docker [Desktop] for Mac" does run a Linux host VM with a replacement for boot2docker - LinuxKit developed and maintained by Docker for the purpose of making lightweight distributions.
Install from a package Go to https://download.docker.com/linux/ubuntu/dists/ , choose your Ubuntu version, then browse to pool/stable/ , choose amd64 , armhf , arm64 , or s390x , and download the . deb file for the Docker Engine version you want to install.
Docker Desktop currently supports macOS Catalina, macOS Big Sur, and macOS Monterey. At least 4 GB of RAM. VirtualBox prior to version 4.3.30 must not be installed as it is not compatible with Docker Desktop.
Before You Install On an “out-of-the-box” Linux installation, the Docker client, daemon, and all containers run directly on localhost, meaning you can access ports on a Docker container using localhost addressing; something like localhost:8080 or 0.0. 0.0:8376 . On macOS, Docker's daemon runs inside a Linux VM.
docker run -it --name ubuntu ubuntu:xenial bash
You are in a terminal with ubuntu and can do whatever you like.
Note: If you are using an ubuntu version bionic (18.04) or newer (
ubuntu:bionic
orubuntu:latest
), you must run the commandunminimize
inside the container so the tools for human interaction be installed.
To start again after a reboot:
docker start ubuntu docker exec -it ubuntu bash
If you want save your changes:
docker commit ubuntu docker images
See the unnamed image and:
docker tag <imageid> myubuntu
Then you can run another container using your new image.
docker run -it --name myubuntu myubuntu bash
Or replace the former
docker stop ubuntu docker rm ubuntu docker run -it --name ubuntu myubuntu bash
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With