Created
August 5, 2020 09:44
-
-
Save kencoba/0703fe237ca08bf4d7f81d094017d5a1 to your computer and use it in GitHub Desktop.
Vagrantfile for Docker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/bionic64" | |
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" | |
config.vm.network "private_network", ip: "192.168.33.11" | |
config.vm.synced_folder ".", "/vagrant_data" | |
config.vm.provider "virtualbox" do |vb| | |
# # Display the VirtualBox GUI when booting the machine | |
# vb.gui = true | |
# | |
# # Customize the amount of memory on the VM: | |
vb.memory = "1024" | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
# To solve the issue of "vagrant@127.0.0.1: permission denied (publickey)." | |
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config; \ | |
sudo systemctl restart sshd; | |
apt-get update | |
apt-get remove docker docker-engine docker.io containerd runc | |
# install packages to allow apt to use a repository over HTTPS: | |
apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg-agent \ | |
software-properties-common | |
# Add Docker’s official GPG key: | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
# Verify that you now have the key with the fingerprint | |
apt-key fingerprint 0EBFCD88 | |
# set up the stable repository | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
apt-get update | |
apt-get install -y docker-ce docker-ce-cli containerd.io | |
# sudo docker run hello-world | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment