Docker CLI Closes immediately

Support for Ubuntu and other Desktop Linux distributions
Post Reply
thepod7
Posts: 2
Joined: 20 Aug 2022, 16:45

Docker CLI Closes immediately

Post by thepod7 »

I currently have Plex and Filebot installed on a nuc, I am looking to migrate this setup over to running in docker so that I could easily rebuild the system if the nuc ever fails.

I have started with just Filebot, however every time I start the container it starts to load and then just exits. If I have the container set to always restart, it falls into a reboot loop. I don't want to use the watcher feature as all my files will end up being on NFS shares and I am worried about the script running before the file is complete. I was hoping to just run this container and connect to it and run my script as necessary. Is this possible using this image?

Code: Select all

admin@nuc-media:~$ sudo docker-compose up
Creating network "media_net" with driver "macvlan"
Creating filebot ... done
Attaching to filebot
filebot    |
filebot    | --------------------------------------------------------------------------------
filebot    |
filebot    | Hello! Do you need help Getting Started?
filebot    |
filebot    | # FAQ
filebot    | https://www.filebot.net/linux/docker.html
filebot    |
filebot    | # Read License Key from Console
filebot    | docker run --rm -it -v data:/data rednoah/filebot --license
filebot    |
filebot    | --------------------------------------------------------------------------------
filebot    |
filebot    | FileBot 4.9.6 (r9125)
filebot    |
filebot    |  -rename                                : Rename media files
filebot    |  --db [TheTVDB, AniDB, TheMovieDB::TV]  : Database
filebot    |  or [TheMovieDB] or [AcoustID, ID3] or
filebot    |  [xattr, exif, file]
filebot    |  --order [Airdate, DVD, Absolute]       : Episode order
filebot    |  --format {expression}                  : Format expression
filebot    |  --action [move, copy, keeplink,        : Rename action
filebot    |  symlink, hardlink, clone, test]
filebot    |  --conflict [skip, override, auto,      : Conflict resolution
filebot    |  index, fail]
filebot    |  --filter {expression}                  : Filter expression
filebot    |  --mapper {expression}                  : Mapper expression
filebot    |  --q [name] or [id] or {expression}     : Query expression
filebot    |  --lang [English, German, Spanish]      : Language
filebot    |  -non-strict                            : Enable advanced matching and more
filebot    |                                           aggressive guess work
filebot    |  -r                                     : Select files from folders recursively
filebot    |  -d                                     : Select folders
filebot    |  --file-filter {expression}             : Input file filter expression
filebot    |  --output /path/to/folder               : Output directory
filebot    |  --apply [artwork, cover, nfo, date,    : Apply post-processing actions
filebot    |  metadata, import, prune, clean]
filebot    |  -exec echo {f} [+*]                    : Execute command
filebot    |  -extract                               : Extract archives
filebot    |  -check                                 : Create / Check verification files
filebot    |  -get-subtitles                         : Fetch subtitles
filebot    |  --encoding [UTF-8, Windows-1252]       : Output character encoding
filebot    |  -list                                  : Print episode list
filebot    |  -find                                  : Print file paths
filebot    |  -mediainfo                             : Print media info
filebot    |  -script [fn:name] or [script.groovy]   : Run Groovy script
filebot    |  --def name=value                       : Define script variables
filebot    |  -revert                                : Revert files
filebot    |  --mode [interactive]                   : Enable CLI interactive mode
filebot    |  --log [all, fine, info, warning, off]  : Log level
filebot    |  --log-file *.txt                       : Log file
filebot    |  -clear-cache                           : Clear cached and temporary data
filebot    |  -clear-prefs                           : Clear application settings
filebot    |  -clear-history                         : Clear rename history
filebot    |  -unixfs                                : Allow special characters in file paths
filebot    |  -no-xattr                              : Disable extended attributes
filebot    |  -no-probe                              : Disable media parser
filebot    |  -no-history                            : Disable history
filebot    |  -no-index                              : Disable media index
filebot    |  -version                               : Print version identifier
filebot    |  -help                                  : Print this help message
filebot    |  --license *.psm                        : Import license file
filebot    |
admin@nuc-media:~$ sudo docker ps
CONTAINER ID   IMAGE             COMMAND                  CREATED          STATUS                                  PORTS     NAMES
97d13a5c5207   rednoah/filebot   "/opt/bin/run-as-use…"   31 seconds ago   Restarting (1) Less than a second ago             filebot
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Docker CLI Closes immediately

Post by rednoah »

You're using a command-line tool, and as such it will execute and then exit. A command-line tool generally is not expected to run indefinitely.


e.g. run filebot

Code: Select all

filebot -script fn:sysinfo
e.g. run filebot in a docker container:

Code: Select all

docker run --rm -it -v $PWD:/volume1 -v data:/data rednoah/filebot -script fn:sysinfo
:idea: So if filebot isn't running, the container isn't running either, and it's not supposed to. It's not a web service.



:idea: You could do --entrypoint /bin/bash to run an interactive bash shell instead of filebot when you start the container. The bash shell would run indefinitely, waiting for input.


:idea: The filebot-xpra remote desktop environment might be more suitable for your use case since that will run indefinitely by nature of being a web service:

Code: Select all

docker run --rm -it -v $PWD:/volume1 -v data:/data -p 5454:5454 rednoah/filebot:xpra
:idea: Please read the FAQ and How to Request Help.
thepod7
Posts: 2
Joined: 20 Aug 2022, 16:45

Re: Docker CLI Closes immediately

Post by thepod7 »

Thanks - that makes sense, didn't even think about that one.

Do you recommend the xpra vs. the node version? Seems like I could get by with just the node version.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Docker CLI Closes immediately

Post by rednoah »

Yep, both will work. The node version will run a web service, and the xpra will run a full desktop environment and VNC service, so the first one will use less resources. But at this point you could also use the watcher and have it watch / or some other system folder that exists but never changes so that it'll do nothing but also run forever. :lol:


:idea: You might want to build your own container (just change the startup script) if you just need a container that happens to have the filebot command pre-installed but somehow keeps running doing nothing.
:idea: Please read the FAQ and How to Request Help.
Post Reply