vagrant-docker-provider icon indicating copy to clipboard operation
vagrant-docker-provider copied to clipboard

once again :default: Warning: Remote connection disconnect. Retrying... with with Ubuntu 23.04 and latest Docker 4.22

Open RomanShestakov opened this issue 1 year ago • 0 comments

Hello,

sadly looks like the old issue discussed and resolved here: https://github.com/rofrano/vagrant-docker-provider/issues/5 returned again

I tried to build the imagine in this repo with Ubuntu 23.04 and latest Docker 4.22

and got

=> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2200 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying...

any ideas why it happens this time around?

to replicate I used this Vagrantfile:


-- mode: ruby --

vi: set ft=ruby :

Vagrant.configure(2) do |config| config.vm.hostname = "ubuntu"

############################################################

Provider for Docker on Intel or ARM (aarch64)

############################################################ config.vm.provider :docker do |docker, override| override.vm.box = nil #docker.image = "rofrano/vagrant-provider:ubuntu" docker.build_dir = "." 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"] # Uncomment to force arm64 for testing images on Intel # docker.create_args = ["--platform=linux/arm64", "--cgroupns=host"] end

Install Docker and pull an image

config.vm.provision :docker do |d|

d.pull_images "alpine:latest"


and Dockerfile with Ubuntu 23.04:


FROM ubuntu:23.04 LABEL MAINTAINER="John Rofrano [email protected]"

ENV DEBIAN_FRONTEND noninteractive

Install packages needed for SSH and interactive OS

RUN apt-get update &&
yes | unminimize &&
apt-get -y install
openssh-server
passwd
sudo
man-db
curl
wget
vim-tiny &&
apt-get -qq clean &&
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Enable systemd (from Matthew Warman's mcwarman/vagrant-provider)

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in ; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done);
rm -f /lib/systemd/system/multi-user.target.wants/
;
rm -f /etc/systemd/system/.wants/;
rm -f /lib/systemd/system/local-fs.target.wants/;
rm -f /lib/systemd/system/sockets.target.wants/udev;
rm -f /lib/systemd/system/sockets.target.wants/initctl;
rm -f /lib/systemd/system/basic.target.wants/
;
rm -f /lib/systemd/system/anaconda.target.wants/*;

Enable ssh for vagrant

RUN systemctl enable ssh.service; EXPOSE 22

Create the vagrant user

RUN useradd -m -G sudo -s /bin/bash vagrant &&
echo "vagrant:vagrant" | chpasswd &&
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant &&
chmod 440 /etc/sudoers.d/vagrant

Establish ssh keys for vagrant

RUN mkdir -p /home/vagrant/.ssh;
chmod 700 /home/vagrant/.ssh ADD https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub /home/vagrant/.ssh/authorized_keys RUN chmod 600 /home/vagrant/.ssh/authorized_keys;
chown -R vagrant:vagrant /home/vagrant/.ssh

Run the init daemon

VOLUME [ "/sys/fs/cgroup" ] CMD ["/usr/sbin/init"]


Regards, Roman

RomanShestakov avatar Aug 06 '23 21:08 RomanShestakov