Guidance on adding a docker hub container


kennelm

Recommended Posts

I'm interested in running a squid proxy server I found at docker hub:

 

https://hub.docker.com/r/sameersbn/squid

 

There's no unraid template for this container that I can find, so I'm looking for guidance on how I can get this up and running.   I was able to install the container, but I haven't configured it properly, so it won't respond to requests.   For example, I am not sure what kind of network config it needs: host, bridge, or custom. 

 

I can see that the documentation suggests it needs at least two parameters:  --publish 3128:3128  --volume /srv/docker/squid/cache:/var/spool/squid

I think I can pass these in as extra parameters in the unraid docker template?  Or should I just set up a mapping in the template?

 

Can I assume that /srv/docker/squid/cache is intended to be a path on the host and should be adapted as /mnt/cache/appdata/squid?

 

Advice appreciated! 

 

Link to comment
  • 3 weeks later...
On 12/29/2020 at 5:01 PM, kennelm said:

For example, I am not sure what kind of network config it needs: host, bridge, or custom. 

 

Without knowing the first thing about the application itself i would assume you want a bridge network seeing as the documentation suggests publishing a port mapping.

 

On 12/29/2020 at 5:01 PM, kennelm said:

I can see that the documentation suggests it needs at least two parameters:  --publish 3128:3128  --volume /srv/docker/squid/cache:/var/spool/squid

I think I can pass these in as extra parameters in the unraid docker template?  Or should I just set up a mapping in the template?

You should setup the mapping in the template rather than using extra parameters. Publish equates to a Port mapping. Volume to a volume mapping. 

On 12/29/2020 at 5:01 PM, kennelm said:

Can I assume that /srv/docker/squid/cache is intended to be a path on the host and should be adapted as /mnt/cache/appdata/squid?

 

Yes that looks right to me.

 

35 minutes ago, Zappmax said:

Hi,

 

i am also interested in installing docker images directly from docker hub  but i dont know how do download (docker pull xyz) . I was in the docker menu and there is "add container" but the pull command failed. How did you install it?

 

thx

 

Zappmax

It is best to use Community Applications to install containers. In the CA settings there should be an option to allow searching docker hub. Once that is enabled, simply search for the particular image you want in CA, then click the Whale to get results from docker hub. There is probably a little better description of how to do this somewhere already posted elsewhere on the forum. Most likely in the Community Applications support thread.

  • Like 1
Link to comment
  • 4 weeks later...

I very rarely use Community Applications to install containers on my server.  Actually just today I finished making another container and getting it running on my server.

 

If you can find a Docker container on Docker Hub, you can most likely get it running on unRAID with no issues.  To setup a new container, just follow a few steps and you shouldn't have many issues.

 

  • Read the official Docker container documentation very thoroughly.  Seriously, I can't tell you how many times I've failed to get a container started because I missed a parameter, or how many containers I've skipped adding a volume to only to find out no config saved after a restart.
  • Go to your Docker Tab in unRAID and click Add Container
  • Leave the Template blank.  unRAID will create a template when you get your container running
  • Give it a name- not like Bob or Sally, but a name which is basically what the container is.  Plex, LetsEncrypt, etc.
  • In Repository, enter the Docker Hub repository along with the tag, eg. homeassistant/home-assistant:stable where stable is the tag.  Docker Hub is good about telling you the Docker command to run the container, you just don't need the docker run portion in this field
  • Network Type is where things can get tricky.  Host shares the IP with the server.  Bridge gives the container a unique IP address within the private network of Docker.  Most of my containers use Bridge.  If you want to get really technical you can create Docker networks.  My Home Assistant container runs on a network I created that is on my smart home VLAN.
  • If your container requires a PATH, and if you plan on saving data it will, click Add another Path, Port, Variable, Label or Device and in the dropdown select Port. 
    • Name is human readable only and I've played with a lot of different naming conventions, but I just stick to the container path without the leading slash, so config for example. 
    • Container Path is the path the container needs, so for my HA container, it's /config
    • Host Path is the path on your unRAID server to store the data, so for my HA container, it's /mnt/cache/docker_stash/homeassistant/ and as you can see I've created a folder that only exists on my cache drive for Docker.  This is unnecessary but I was using a small 15k drive when I created this and didn't have much space for anything other than my Docker container on the drive.  This was just a workaround and I'll eventually move it all to another folder
  • If your container requires a PORT, click Add another Path, Port, Variable, Label or Device and in the dropdown select Port
    • Name is human readable only, but for the most part I just make it the port number.  Sometimes I'll specify that it's for, like Web UI but that's rare
    • Container Port is the port the container needs opened which will be in the container documentation
    • Host Port is the port you want to direct this to on your unRAID server.  If you have a container that needs port 80, this is where you would redirect to 81, 8080, etc.
    • Connection Type is either TCP or UDP.  Again the container documentation will tell you and if it doesn't, assume TCP.  If it doesn't work, edit the container and try UDP.
  • If you need more settings than you can access with the Add another Path, Port, Variable, Label or Device, then in the upper right you can toggle the switch that says Basic View and get into Advanced View.  From here you can specify the Docker Hub URL, Icon URL and even the WebUI which for Home Assistant is http://[IP]:[PORT:8123]/lovelace.  So you see you can do the IP, port and even a path all in here so you can easily access your UI from the main unRAID screen.  Extra Parameters is where odd things go, such as on my Home Assistant I'm skipping my Pi-Hole container with --dns=1.1.1.1 to tell the container to use Cloudfare's DNS.

As you can see, you have quite a bit of flexibility and power with unRAID.  When I first got in and was learning about running Dockers on unRAID it sure seemed narrow minded just to limit myself to only the Community Applications and I wanted to figure out how to do it on my own.  If there is already a Community Application that gets me there, I'll use it but I don't want to be limited to only that one place when there are so many containers.  Also, the beauty of Docker is if 100 people make containers for something like Plex or Home Assistant, you can always switch your Repository if the one you are using isn't keeping current and just save your settings.  As long as they aren't doing some weird stuff for their container, you shouldn't have to change any ports, paths, etc. and it should just work.

  • Like 6
  • Thanks 4
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.