szabodanika / microbin

A secure, configurable file-sharing and URL shortening web app written in Rust.
https://microbin.eu
BSD 3-Clause "New" or "Revised" License
2.65k stars 163 forks source link

Unable to start with `docker run` #195

Closed mcdent closed 1 year ago

mcdent commented 1 year ago

What am I doing wrong, for some reason my port is being ignored? Even on port 8080 I cannot connect?

❯ docker run --name microbin -p 9696:8080  -v /home/mike/docker/microbin/microbin-data:/app/microbin_data danielszabo99/microbin
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
2023-07-15T21:53:07 [INFO] - MicroBin starting on http://0.0.0.0:8080
2023-07-15T21:53:07 [INFO] - Starting 1 workers
2023-07-15T21:53:07 [INFO] - Actix runtime found; starting in Actix runtime

This is RHEL 9.2 with Podman.

szabodanika commented 1 year ago

Remember, -p 9696:8080 is a port mapping, it does not set which port MicroBin should run on. But in your case, this should work just fine and you should be able to access MicroBin at http://localhost:9696, so I am not sure what went wrong in your case. If you would like to change MicroBin's port, you can use environmental variables. You can set them with a .env file for example. You will find the variables on the website and a recommended .env file in the repository. You should try the quick docker setup script, it's in the README and on the website front page as well.

mcdent commented 1 year ago

I wanted to set this up using Podman and Quadlet which I have now done. Unsure why I could not connect but all is fine now. With this setup it's possible for the containers to update themselves automatically if you wish.

Here is my podman unit file in case its of any use to somebody with RHEL.

[Unit]
Description=Microbin
After=local-fs.target

[Container]
Image=docker.io/danielszabo99/microbin
Volume=/home/mike/docker/microbin/microbin-data:/app/microbin_data
PublishPort=9696:8080
Environment=TZ=Europe/London
EnvironmentFile=/home/mike/docker/microbin/environment.env
ContainerName=microbin
Label="io.containers.autoupdate=registry"
Exec=

[Install]
# Start by default on boot
WantedBy=multi-user.target default.target
szabodanika commented 1 year ago

Glad you managed to make it work in the end, if you find out later what was causing the connection issue please do share. Just something regarding the automatic container update, please be careful with that as some users have been reporting that MicroBin reinitialised the database when they updated the container manually. Until we figure out why that was happening, I would recommend manually updating MicroBin instead so you don't lose any important data if I push an update at the wrong time.

Also, thank you for becoming a sponsor 🙂