Expose port on a container

Hi everyone,
I am working on an idea to create an Alpine container with mosquitto broker. To do this I installed mosquitto-clients on the container but when I want to access to the container from the host I have this:


I want to know how I can expose the 1883 port like in docker.
Thanks for helping me.

Regards

Hi @amirrekik, have no idea what you want to achieve but why are you using docker just install a simple alpine container and install mosquitto but I have not too much exprience with apk then you can expose the specified port with proxy.

lxc launch images:alpine/edge/cloud mos
lxc shell mos
apk add <mosquitto_package name>
You have to enable service in alpine with rc.update (start) something.
Then on the host lxc config device add proxy ... 

Instead of Alpine, if you have no experience with it, try another container which supports systemd.
Regards.

You can use proxy device Type: proxy - LXD documentation or network forward How to configure network forwards - LXD documentation