coppit Posted June 23, 2015 Share Posted June 23, 2015 I'd like to move my development off of my unraid server. Has anyone worked through setting up TLS on the daemon, so that you connect remotely? Edit: I figured it out, so I'll edit this top post to be a HOWTO. First, I didn't bother setting up security because docker is only exposed on my LAN. If you want security, check out the Docker docs. [*]On your unraid sever, edit /boot/config/docker.cfg, adding two -H options:[br] DOCKER_OPTS="--storage-driver=btrfs -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375" [*]On your remote machine, install the docker client. Then either add the -H tcp://tower:2375 option to your docker command, or put export DOCKER_HOST=tcp://tower:2375 into your ~/.bashrc. When you're done, you can run "docker ps", "docker build" or whatever from your dev machine, with all the action happening on your unraid server. I like this better because I'm on my normal dev machine, with github credentials, my favorite GUI editor, etc. 3 Quote Link to comment
sparklyballs Posted June 23, 2015 Share Posted June 23, 2015 i build my dockers in a VM running on my unraid server. Quote Link to comment
hernandito Posted June 23, 2015 Share Posted June 23, 2015 How do you build the Dockers in this fashion? I create a repo in Github, start with a similar dockerfile and add anything needed. I then create a new Auto Build repo in dockerhub. There is a lot of trial and error... If there is a better work flow, I would love to know about it. Quote Link to comment
sparklyballs Posted June 23, 2015 Share Posted June 23, 2015 How do you build the Dockers in this fashion? I create a repo in Github, start with a similar dockerfile and add anything needed. I then create a new Auto Build repo in dockerhub. There is a lot of trial and error... If there is a better work flow, I would love to know about it. for me, i have a ubuntu 14.04 VM that i've installed docker in, following the instructions on the docker website. then i write a dockerfile (got enough now that a lot of it is copy paste, dependant on type) and build it on the VM. that's 1 way, if it's a tougher docker, i fire up a container with just bash and try to build from straight linux commands, then play them back to create the dockerfile once i've found what works. Quote Link to comment
coppit Posted June 23, 2015 Author Share Posted June 23, 2015 Do you literally build and run them in the VM, or have you set DOCKER_OPTS="-H tcp://tower..." so that the containers run in unraid? That's what I was planning to do, since I have one or two containers that I may not share on Docker hub. Quote Link to comment
sparklyballs Posted June 23, 2015 Share Posted June 23, 2015 Do you literally build and run them in the VM, or have you set DOCKER_OPTS="-H tcp://tower..." so that the containers run in unraid? That's what I was planning to do, since I have one or two containers that I may not share on Docker hub. manually create the container on the unraid box itself and you can stop/start it from the dashboard like any other container. only thing i found doing it like that (or at least the last time i did) is that you get an orphan image for the base build that isn't easily deletable because unraid thinks it's in use by other dockers that may use the same base image. Quote Link to comment
pervel Posted November 22, 2020 Share Posted November 22, 2020 On 6/23/2015 at 6:09 AM, coppit said: *]On your unraid sever, edit /boot/config/docker.cfg, adding two -H options:[br] DOCKER_OPTS="--storage-driver=btrfs -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375" Is this still the right way to do it? I haven't been able to find any other information about it and this thread is 5 years old. So I'm worried the solution is outdated. The description above seems to suggest that DOCKER_OPTS is already defined in docker.cfg. However, my docker.cfg for Unraid version 6.9.0-beta35 does not define it. So I figured it was best to define it with only the two -H options: DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375" Is this the right approach today? Also, are these kinds of edits to the config files preserved when upgrading Unraid? Quote Link to comment
pervel Posted November 24, 2020 Share Posted November 24, 2020 After investigating a bit more I have figured out that a better way to access the Unraid docker host is via SSH. This requires no extra docker configuration on the Unraid side. You just need to use SSH key-based authentication and then connect either using the -H option to the docker command or setting the DOCKER_HOST environment variable in your local shell. For example: docker -H ssh://your-unraid-server ps Or using DOCKER_HOST: export DOCKER_HOST=ssh://your-unraid-server docker ps 1 Quote Link to comment
piyper Posted November 28, 2020 Share Posted November 28, 2020 (edited) I just edited the script rc.docker I didn't add to the $DOCKER_OPTS variable but I did change the line that starts docker to hardcode the -H parameters, like this: nohup $UNSHARE --propagation slave -- $DOCKER -p $DOCKER_PIDFILE $DOCKER_OPTS -H unix:///var/run/docker.sock -H tcp://IP_ADDRESS:PORT_NUMBER>>$DOCKER_LOG 2>&1 & IP_ADDRESS being the ip of the unraid server I changed this for all of my unraid servers and they all listen on port PORT_NUMBER This works great and my code can now access and manage all the docker hosts and the containers within I was thinking of changing the script to read "DOCKER_OPTS" from the cfg file, but never got around to it. It would be extremely helpful if the "DOCKER_OPTS" setting was supported by default. Edited November 28, 2020 by piyper Quote Link to comment
tcwatson Posted December 21, 2020 Share Posted December 21, 2020 On 11/27/2020 at 9:57 PM, piyper said: I just edited the script rc.docker I didn't add to the $DOCKER_OPTS variable but I did change the line that starts docker to hardcode the -H parameters, like this: nohup $UNSHARE --propagation slave -- $DOCKER -p $DOCKER_PIDFILE $DOCKER_OPTS -H unix:///var/run/docker.sock -H tcp://IP_ADDRESS:PORT_NUMBER>>$DOCKER_LOG 2>&1 & IP_ADDRESS being the ip of the unraid server I changed this for all of my unraid servers and they all listen on port PORT_NUMBER This works great and my code can now access and manage all the docker hosts and the containers within I was thinking of changing the script to read "DOCKER_OPTS" from the cfg file, but never got around to it. It would be extremely helpful if the "DOCKER_OPTS" setting was supported by default. Thank you! Seems like there's not a lot of information on how to do this around, so I was glad to find your solution. It worked for me on Unraid 6.8.3. Quote Link to comment
Timm Posted December 22, 2020 Share Posted December 22, 2020 On 6/23/2015 at 6:09 AM, coppit said: [...] [*]On your unraid sever, edit /boot/config/docker.cfg, adding two -H options:[br] DOCKER_OPTS="--storage-driver=btrfs -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375" [...] Thanks for that. That almost worked for me, all I had to do differently is to switch to port 2376. Quote Link to comment
reboot81 Posted May 28, 2023 Share Posted May 28, 2023 To monitor my docker containers on my second Unraid server with Uptime Kuma, I added DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://192.168.0.14:2375" To my /boot/config/docker.cfg file. (It also worked with 0.0.0.0, what's the difference?) Quote Link to comment
xxredxpandaxx Posted September 26, 2023 Share Posted September 26, 2023 When I add this to my docker.cfg docker fails to start. I haven't had time to look into it yet, but does this method still work? Quote Link to comment
sirtlks Posted September 30, 2023 Share Posted September 30, 2023 This topic is helpful. This is still the right approach today. ①Add it to config file /boot/config/docker.cfg DOCKER_OPTS="--storage-driver=btrfs -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375" ②restart dockerd service in terminal. /etc/rc.d/rc.docker restart Quote Link to comment
PlanetDyna Posted February 3 Share Posted February 3 Its not working unfourtunately. Something wrong? Quote Link to comment
PlanetDyna Posted February 11 Share Posted February 11 Someone can have a quick look? Quote Link to comment
Gex2501 Posted February 28 Share Posted February 28 On 2/11/2024 at 5:10 AM, PlanetDyna said: Someone can have a quick look? I believe you are missing the storage-drive option: DOCKER_OPTS="--storage-driver=btrfs -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375" Quote Link to comment
PlanetDyna Posted February 29 Share Posted February 29 (edited) Thank you. I will test it next days! Working! I missed change connection-type to "TCP/HTTP". Edited March 5 by PlanetDyna Quote Link to comment
Recommended Posts
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.