docker mounts not working

abraham_v

Dabbler
Joined
May 15, 2021
Messages
16
Hello folks!

I am attempting to run an FTP server via docker on TrueNAS. This is more of an exercise to learn how docker works in SCALE than anything else.

As a reference point, I'm able to spin up the following container on an ubuntu system and connect to it successfully;
Code:
$ docker run -v $(pwd):/home/username \
   -e USER=username -e PASSWORD=password \ 
   -p 4567:21 -p 3000-3010:3000-3010 \
   mikatux/ftps-server


For the life of me, I cannot get the same thing to work within TrueNAS. Here is what I'm doing,

* Login to TrueNAS web interface
* click "Apps" menu on the left side
* click "Manage Docker Images" tab
* near the top, click the "Pull Image" button. Fill in my credentials for docker hub and type in these values,
Code:
Image Name = mikatux/ftps-server
Image Tag = latest

* click "Save". The image gets downloaded to my TrueNAS server without issues.
* click the blue "Launch Docker Image" button and fill in the following,
Code:
Page 1 (Image and Policies):
Application Name = `testftp`
Image Repository = `mikatux/ftps-server`
Image Tag = `latest`
Image Pull Policy = `Only pull image if not present on host.`
Update Strategy = `Kill existing pods before creating new ones.`

Page 2(Container Settings):
Container CMD = ` ` (i.e. leave this blank, enter nothing)
Container Args = ` `  (i.e. leave this blank, enter nothing)
Add containerEnvironmentVariables,
```
USER = flakes
PASSWORD = pass123
```

Page 3 (Networking):
defaults - no change; host network NOT checked.

Page 4 (Port Forwarding List):
Container Port = `21`
Node Port = `9888`
Protocol = `TCP Protocol`

Page 5 (Host Path Volumes):
-do nothing, skip-

Page 6(Volumes):
Dataset Name: `testftp`
Mount Path: `/home/flakes`

Page 7(Security Settings):
not checking the privileged box (default)

Page 8 (Confirm Options):
click final button to go ahead!



I am able to start the application (or container) successfully. Under the "Installed Applications" tab, it shows up with a green "ACTIVE" box. But attempting to login to the server via Filezilla using 192.168.1.20:9888 , I can see authentication passing, but it fails on the next step to list folders.

Have been trying out a few different variants - using host filesystem (no dataset), changing username, changing mount path ... etc. But no success.

Any ideas on what I could try next?

- Abraham V.
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
Firstoff this is a rather... crude way of handling a fileshare on SCALE. filetransfers over SSH on native SCALE would be a lot cleaner.

Anyway:
if you carefully looked at the different between your two setup updates, you would've noticed you ignored half of the forwarded ports from the ubuntu example ;-)
 

abraham_v

Dabbler
Joined
May 15, 2021
Messages
16
I did not notice that some ports were missing! Thank you for pointing it out.

The original docker container I used did not have a way to customise those ports, so I found another one. On my local ubuntu box this works;
Code:
$ docker run -it --rm \
                -p 11021:21 \
                -e FTP_USER=admin -e FTP_PASS=admin -e HOST=localhost \
                -p 65000-65004:65000-65004 \
                -e PASV_MIN_PORT=65000 -e PASV_MAX_PORT=65004 \
                -v $(pwd):/data/admin \
                mcreations/ftp


That is a lot of environment variables and port forwarding, but I was able to configure it using the blue "Launch docker image" button in TrueNAS SCALE. Here are my settings, (NOTE: The HOST IP is what the TrueNAS system is statically assigned)
Code:
Page 1 (Image and Policies):
Application Name: testftp
Image Repository: mcreations/ftp
Image Tag: latest
Image Pull Policy: Only pull image if not present on host
Update Strategy: Kill existing pods before creating new ones.

Page 2 (Container Settings):
Container CMD: 
Container Args:
Add containerEnvironmentVariables:
FTP_USER=admin
FTP_PASS=admin
HOST=192.168.1.20
PASV_MIN_PORT=65000
PASV_MAX_PORT=65004

Page 3 (Networking):
- default values -

Page 4 (Port Forwarding List):
11021:21
65000:65000
65001:65001
65002:65002
65003:65003
65004:65004

Page 5 (Host Path Volumes):
- default values (i.e. nothing) -

Page 6 (Volumes):
Dataset Name: testftp
Mount Path: /data/admin

Page 7 (Security Settings):
- default values -

Page 8 (Confirm Options):
Click blue "Submit" button


I must say, it is pleasantly surprising to see it work! With my inexperience with TrueNAS, I kept thinking there was something wrong about the way I created the dataset or even in how it was connected. To think it was a configuration oversight...

For the record - I am aware that this is not the best approach to setting up an FTP server on TrueNAS, but the point of the exercise was to gain some familiarity with how a random docker image worked with TrueNAS datasets. When learning new technologies, I find it helpful to use things I'm familiar with and slowly add on the unfamiliar things.

Thanks again @ornias ! I would have concluded that SCALE was just not for me if I didn't get this working. :D

-Abraham V.
 

silverback

Contributor
Joined
Jun 26, 2016
Messages
134
I did not notice that some ports were missing! Thank you for pointing it out.

The original docker container I used did not have a way to customise those ports, so I found another one. On my local ubuntu box this works;
Code:
$ docker run -it --rm \
                -p 11021:21 \
                -e FTP_USER=admin -e FTP_PASS=admin -e HOST=localhost \
                -p 65000-65004:65000-65004 \
                -e PASV_MIN_PORT=65000 -e PASV_MAX_PORT=65004 \
                -v $(pwd):/data/admin \
                mcreations/ftp


That is a lot of environment variables and port forwarding, but I was able to configure it using the blue "Launch docker image" button in TrueNAS SCALE. Here are my settings, (NOTE: The HOST IP is what the TrueNAS system is statically assigned)
Code:
Page 1 (Image and Policies):
Application Name: testftp
Image Repository: mcreations/ftp
Image Tag: latest
Image Pull Policy: Only pull image if not present on host
Update Strategy: Kill existing pods before creating new ones.

Page 2 (Container Settings):
Container CMD:
Container Args:
Add containerEnvironmentVariables:
FTP_USER=admin
FTP_PASS=admin
HOST=192.168.1.20
PASV_MIN_PORT=65000
PASV_MAX_PORT=65004

Page 3 (Networking):
- default values -

Page 4 (Port Forwarding List):
11021:21
65000:65000
65001:65001
65002:65002
65003:65003
65004:65004

Page 5 (Host Path Volumes):
- default values (i.e. nothing) -

Page 6 (Volumes):
Dataset Name: testftp
Mount Path: /data/admin

Page 7 (Security Settings):
- default values -

Page 8 (Confirm Options):
Click blue "Submit" button


I must say, it is pleasantly surprising to see it work! With my inexperience with TrueNAS, I kept thinking there was something wrong about the way I created the dataset or even in how it was connected. To think it was a configuration oversight...

For the record - I am aware that this is not the best approach to setting up an FTP server on TrueNAS, but the point of the exercise was to gain some familiarity with how a random docker image worked with TrueNAS datasets. When learning new technologies, I find it helpful to use things I'm familiar with and slowly add on the unfamiliar things.

Thanks again @ornias ! I would have concluded that SCALE was just not for me if I didn't get this working. :D

-Abraham V.
How were you able to get your container setting into code tags? Thanks in advance.
 

abraham_v

Dabbler
Joined
May 15, 2021
Messages
16
How were you able to get your container setting into code tags? Thanks in advance.
Manual typing. I have a habit of making detailed notes of things like this for personal record-keeping. Probably not something most folks would put effort into, but it works for me. Especially when, months later I ask myself "How did I set this up before?"

- Abraham V.
 
Top