Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Developing on Apple M1 Silicon with Virtual Environments

John Rofrano
Nerd For Tech
Published in
5 min readMay 10, 2021

--

Docker on Apple Silicon

Coercing a Container to behave like a VM

Building a Multi-Architecture Docker Image

$ export DOCKER_BUILDKIT=1
$ docker buildx create --use --name=qemu
$ docker buildx inspect --bootstrap
$ docker buildx build --platform linux/amd64,linux/arm64 --push --tag rofrano/vagrant-provider:ubuntu .

Final Solution

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.hostname = "ubuntu"
# Provider for VirtualBox
config.vm.provider :virtualbox do |vb|
vb.memory = "1024"
vb.cpus = 2
end
# Provider for Docker
config.vm.provider :docker do |docker, override|
override.vm.box = nil
docker.image = "rofrano/vagrant-provider:ubuntu"
docker.remains_running = true
docker.has_ssh = true
docker.privileged = true
docker.volumes = ["/sys/fs/cgroup:/sys/fs/cgroup:rw"]
docker.create_args = ["--cgroupns=host"]
end
# Provision Docker Engine and pull down PostgreSQL
config.vm.provision :docker do |d|
d.pull_images "postgres:alpine"
d.run "postgres:alpine",
args: "-d -p 5432:5432 -e POSTGRES_PASSWORD=postgres"
end
end
$ vagrant up --provider=docker
$ vagrant ssh

Conclusion

--

--

Nerd For Tech
Nerd For Tech

Published in Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

John Rofrano
John Rofrano

Responses (3)