

-d (not used): Run the container in the background so that the console is free.Īt this time we can run the Mosquitto container but we do not have defined any username or password.

The left side of the “:” defines the path of the host system and the right side the path in the container. -v: bind mount volumes between the host system and the container.–name: gives the container a custom name to stop and restart the container by his name.We match port 1883 of the host to port 1883 of the container. -p: define the published ports to the container.-it: create an interactive bash shell in the container.Now we can create and start the Mosquitto container with the following command.ĭocker run -it -p 1883: 1883 -name mosquitto -v ~/mosquitoconfig -v ~/mosquitto/data:/mosquitto/data -v ~/mosquitto/log:/mosquitto/log eclipse-mosquitto We use the following command to get Mosquitto access to the mosquitto folder via port 1883. This is done by the chown command that stands for change owner. Now we have to make sure that Mosquitto as a Docker container get the permission to access these folders.
