Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Basics Dockerfile

Featured Replies

Hi, as i started to create a own docker may some basic questions as i didnt came further yet ...

 

sample, if i want to use a variable in the run command wich i then can configure, how would that look like in the dockerfile

 

sample from Dockerfile

 

# port command
CMD ["-port=34400"]

 

now i tried with entries like

 

ENV webport

CMD ["-port=$webport"]

 

or

 

ARG ...

 

i guess its pretty basic but after reading several things i really dont get a clue ... ;)

 

next step would be to add stuff like if, then ... but first it would be nice for this basic help

 

thanks ahead

21 minutes ago, alturismo said:

Hi, as i started to create a own docker may some basic questions as i didnt came further yet ...

 

sample, if i want to use a variable in the run command wich i then can configure, how would that look like in the dockerfile

 

sample from Dockerfile

 

# port command
CMD ["-port=34400"]

 

now i tried with entries like

 

ENV webport

CMD ["-port=$webport"]

 

or

 

ARG ...

 

i guess its pretty basic but after reading several things i really dont get a clue ... ;)

 

next step would be to add stuff like if, then ... but first it would be nice for this basic help

 

thanks ahead

You shouldn't set variables in the Dockerfile itself as a general rule, variables come into play at the runtime stage not the build stage.

 

Might be helpful if you linked a Github repo or something, 'cos I'm not entirely clear what you're trying to do.

  • Author
23 minutes ago, CHBMB said:

You shouldn't set variables in the Dockerfile itself as a general rule, variables come into play at the runtime stage not the build stage.

 

Might be helpful if you linked a Github repo or something, 'cos I'm not entirely clear what you're trying to do.

sure pretty simple, i try learning a little about building docker

 

sample

 

https://github.com/alturismo/xTeveTest/blob/master/Dockerfile <- working nuttom command port 34400

 

as you see i run the app and the port in docker hardcoded, now i d like to make the port configurable through the webgui,

so my start was to make it variable

 

so i could set something in unraid gui ...

 

sample

image.thumb.png.e9cc6fe44a985cb43059d633e09d324a.png

 

as mentioned, 1st docker, 1st tests ... i tried some stiff with ENV and ARG but never came to an result ;)

OK, you're getting confused between what you do in docker versus what you do in the Unraid webgui.

 

You add a port not a variable when you want to add a port to a Unraid template.  Set the container port to whatever the container port is, then change the host port to whatever you want it to be.

  • Author

g morning, well, this was just an sample with a port

 

in this case this docker runs in host mode so port setting is obsolete ;) 

 

next step would be to config a subdirectory etc ... thats why i would like to know if i can set a variable to the CMD argue,

or is this always hardcoded ?

cause when i add dockers from apps here i also often can add variables etc wich are then used on docker run

16 hours ago, alturismo said:

g morning, well, this was just an sample with a port

 

in this case this docker runs in host mode so port setting is obsolete ;) 

 

next step would be to config a subdirectory etc ... thats why i would like to know if i can set a variable to the CMD argue,

or is this always hardcoded ?

cause when i add dockers from apps here i also often can add variables etc wich are then used on docker run

You're probably better looking at examples of how it's done. 

 

Dockerfile = uncustomised build that will be the same for everyone.

Init stage = Where customisation happens, copying/linking stuff to persistent storage, ingesting environmental variables to change the way the container runs or functions.

  • Author

thanks for the reply, i thought thats the init stage (variables to the app run command)

 

i tried to figure it by taking a look at some dockers around, but actually didnt come further, nvm,

i ll take another attempt some day ;)

 

thanks again

  • Author

may another question with a different approach

 

i tried now an startup script (entrypoint.sh) to get my execution(s) customizable

my goal is a config file wich then is used for executions

my problem seems to be the loop and detaching the app from terminal so it ll kill the app after the loop is done, while if theres no config file its working ...

 

thanks ahead for an tip

 

sample

 

config.txt

-port="34400" -debug="0"
-config="/root/.xteve/test/" -port="34401" -debug="2"

 

entrypoint.sh

#!/bin/sh

if [ -f "/root/.xteve/custom.txt" ]; then
    echo "Custom config found"

    file="/root/.xteve/custom.txt"
    while read -r line
    do
    if ! [[ ${line:0:1} = \# ]] ; then
        echo "Starting xteve with "$line""
        ./xteve/xteve "$line"                         ### << NOT working, gets executedm then stops ... docker dead ;)
    fi
    done <"$file"
    echo "all custom started"
else
    echo "no custom config, starting default"
    ./xteve/xteve -port="34400" -debug="0"       ### << working
fi

Edited by alturismo

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.