Merge pull request #6 from gotofoo/master

Root fix from gotofoo
This commit is contained in:
PlusMinus0 2017-09-20 17:43:19 +02:00 committed by GitHub
commit ffd0eb8927
3 changed files with 59 additions and 15 deletions

View file

@ -1,7 +1,6 @@
FROM openjdk:8-jre FROM openjdk:8-jre
MAINTAINER PlusMinus <piddlpiddl@gmail.com> MAINTAINER GoToFoo <admin@gotofoo.eu>
# Create directory, downloader JD" and start JD2 for the initial update and creation of config files. # Create directory, downloader JD" and start JD2 for the initial update and creation of config files.
RUN \ RUN \
@ -9,10 +8,8 @@ RUN \
wget -O /opt/JDownloader/JDownloader.jar --user-agent="https://hub.docker.com/r/plusminus/jdownloader2-headless/" --progress=bar:force http://installer.jdownloader.org/JDownloader.jar && \ wget -O /opt/JDownloader/JDownloader.jar --user-agent="https://hub.docker.com/r/plusminus/jdownloader2-headless/" --progress=bar:force http://installer.jdownloader.org/JDownloader.jar && \
java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar
COPY startJD2.sh /opt/JDownloader/ COPY startJD2.sh /opt/JDownloader/
RUN chmod +x /opt/JDownloader/startJD2.sh RUN chmod +x /opt/JDownloader/startJD2.sh
# Run this when the container is started # Run this when the container is started
CMD /opt/JDownloader/startJD2.sh CMD /opt/JDownloader/startJD2.sh

View file

@ -1,12 +1,40 @@
# headless-jd2-docker # docker-jdownloader2-headless
Headless JDownloader 2 Docker Container Headless JDownloader 2 Docker Container
## Running the container ## Running the container
0. `sudo su` 0. Become root:
1. Create a folder on your host for the configuration files (eg. sudo mkdir /config/jd2)
2. run `docker run -d --name jd2 -v /config/jd2:/opt/JDownloader/cfg -v /home/user/Downloads:/root/Downloads plusminus/jdownloader2-headless`
3. stop the container `docker stop jd2`
4. On your host, enter your credentials (in quotes) to the file `org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json` as in `{ "password" : "mypasswort", "email" : "email@home.org" }`
5. Start the container
```
sudo su
```
1. Create a folder on your host for the configuration files (eg. sudo mkdir /config/jd2)
2. Run the container:
```
docker run -d --name jd2 \
-v /config/jd2:/opt/JDownloader/cfg \
-v /home/user/Downloads:/downloads \
gotofoo/jdownloader2-headless
```
3. Wait a minute for the container to initialize
4. Stop the container:
```
docker stop jd2
```
5. On your host, enter your credentials (in quotes) to the file `org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json` as in:
```
{ "password" : "mypasswort", "email" : "email@home.org" }
```
6. Start the container:
```
docker start jd2
```
## Optional environment variables
|Environment Variable|Description|
|--------------------|-----------|
|UID|Specifies the UID the daemon should run as. All created files will be owned by this UID. Defaults to 0 for root.|
|GID|Specifies the GID for all created files. This only works in combination with the UID. Defaults to 0 for root.|

View file

@ -7,11 +7,30 @@ function stopJD2 {
exit exit
} }
if [ "$GID" ]
then
GROUP=jdownloader
groupadd -g $GID $GROUP
else
GROUP=root
fi
if [ "$UID" ]
then
USER=jdownloader
useradd -r -s /bin/false -u $UID -g $GROUP $USER
chown -R $USER:$GROUP /opt/JDownloader
else
USER=root
fi
trap stopJD2 EXIT trap stopJD2 EXIT
java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar & su -c "java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar" -s /bin/bash $USER
while true; do #java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar &
sleep inf
done #while true; do
# sleep inf
#done