Connecting to Container that is in a Vagrant built Ubuntu VM

Hi. I’m trying to move configuration to an Ubuntu VM using Vagrant and Docker so I can recreate locally when needed.

I have this in the Vagrantfile…

  config.vm.provision "docker" do |d|
    d.pull_images "eclipse-mosquitto"
    d.run "mosquitto",
     args: "--restart=always -it -p 1883:1883 -p 9001:9001 -v /vagrant/data/mosquitto/config:/mqtt/config -v /vagrant/data/mosquitto/log:/mqtt/log -v /vagrant/data/mosquitto/data:/mqtt/data toke/mosquitto"

Install seems to go ok but …

  1. I’m unable to connect to the Mosquitto Broker using a device that is set up to send messages to a broker. The only change on the device is the hostname - here I use the ip address of the VM

  2. I can connect to broker using telnet on my local to the port 1883. When I check docker logs mosquitto I see the attempted connection. I don’t see the same when using the device.

Is there a reason why the device is unable to connect?