Understanding Docker


Nem

Recommended Posts

I am tempted by the possibility of switching over to unraid, but I'm having some difficulty in understanding Docker. I have 2 situations that I'm unclear about:

 

1. I want to run mariaDB in one container, Kodi in another, and nginx in yet another. I want nginx and kodi to both be able to access mariaDB - how easy would this be to set up? My understanding is that docker containers are isolated from one another, so is it relatively simple to get one container to talk to another? I guess an extension of this question would be, do docker containers get their own internal IP? If so, I imagine I can just point the nginx/kodi config files to the IP of the mariaDB container?

 

2. I want to run deluge in a container. I also want to be able to install an openvpn client within the same container. Do these containers exist as virtual machines? How easy would it be to SSH into the deluge container, do all the legwork of installing openvpn, related scripts etc. manually? I can understand the process if these are just linux VMs, but I'm not sure if docker containers would change this process at all. Also, would the traffic from the entire machine go through the vpn? Or only deluge traffic from within the same container? I'm looking for the latter

Link to comment

I can answer question 2 for you. There is a Deluge container with inbuilt VPN client (DelugeVPN) that you can use. There is no need to SSH into the container, all VPN settings are done in a config folder outside the container. It’s only the traffic for the Deluge container that goes through the VPN.

 

Support thread: http://lime-technology.com/forum/index.php?topic=38055.0

 

You could of course setup a Linux VM (for example) if your system supports VM and install any application you like but Docker containers are normally using less resources and is often easier to setup so I suggest using that when possible.

Link to comment

To answer question one... the answer is Yes. This is exactly how I use unRAID and Kodi and MariaDB.... everything will be the IP of your server. And the external port of the docker. Dockers get ports for internal use, that you can map to a different port externally. You do NOT use ip of localhost, or 127.0.0.1, etc.

Link to comment

I can answer question 2 for you. There is a Deluge container with inbuilt VPN client (DelugeVPN) that you can use. There is no need to SSH into the container, all VPN settings are done in a config folder outside the container. It’s only the traffic for the Deluge container that goes through the VPN.

 

I currently have the setup on a raspberry pi, but I also have scripts that auto restart deluge/openvpn if they ever go down. How does one set things like crons and execute scripts within docker containers to achieve this? Because I imagine the config folder for docker containers only contain configs directly related to deluge/openvpn in this case, and not crons/scripts

Link to comment

I am not sure exactly on how this could or should be done in the best way but you can have scripts that stops and starts the container and you can use a cron job to run it since cron jobs are implemented in unRAID.

 

As I see this, the tricky part would to be to figure out when your VPN drops so that you could trigger a script rather than being depending on a cron job.

 

It’s good to know that even if you can make changes “inside” the container these are not going to be persistent since an update of the container would restore its original content.

 

From what I understand the implementation of the DelugeVPN container is made in a way that it can detect if the VPN drops and stop the traffic. However, I have no idea if it’s able to reconnect by itself. How knows, it might be possible to have a script that can get VPN status directly from the container.

 

Hopefully somebody else can add some thoughts to this as well.

Link to comment

Dockers are not full vms, look at it like installing an application, they do not mix with each other snd cannot see each others data, it is possible to have them both look at the same data though, you have to configure it.

 

If you want to change something inside the docker: that is not something i would recommend, it might be possible but defeats the purpose of the docker. If you need something special and cannot find a docker for it then use a vm.. Also easy with unraid and built in.

Link to comment

Dockers are not full vms, look at it like installing an application, they do not mix with each other snd cannot see each others data, it is possible to have them both look at the same data though, you have to configure it.

 

By look at the same data I assume you mean if you have a share set up, you can configure dockers to see those shares? What happens in the case of mariaDB, where other dockers need to be able to see the data (database) within the mariaDB docker?

Link to comment

You can make any patt of the unraid filesystem visible to the docker (by default it sees nothing), you configure this frim the unraid docker web page. If you make the same location visible to two dockers they "share" the same data. If they "play nice" when you do that drpends on the application, indo not know mariadb .

Link to comment

By look at the same data I assume you mean if you have a share set up, you can configure dockers to see those shares? What happens in the case of mariaDB, where other dockers need to be able to see the data (database) within the mariaDB docker?

Different containers communicate with each other via Ports.  IE: To have another container be able to access the mariaDB / MySQL database, you tell it to access server-IP:3386.  The exact same way that you would do it if you did not have it running within a container.

 

But, yes you can configure each container to be able to access shares used by other containers.  If you are running say NZBGet and CP, you have to allow each container access to a /Downloads share.  Easy to do.

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.