Adds support for some liniuxserver images

This commit is contained in:
2022-03-01 17:26:32 -05:00
parent 6a9df3be7c
commit 856e97bd28
3 changed files with 12 additions and 3 deletions

View File

@@ -60,10 +60,13 @@
<br>
<button id='createImage'>Create</button>
<h3>List of official images</h3>
<p>Before adding them to the list of correct images you must pull the image.</p>
<ul>
<li>Simple Desktop - lukasdotcom/docker-desktop</li>
<li>Firefox - lukasdotcom/firefox</li>
<li>VScode - lscr.io/linuxserver/code-server</li>
<li>Dekstop v2 - lscr.io/linuxserver/webtop</li>
<li>Firefox v2 - lscr.io/linuxserver/firefox</li>
</ul>
<h3>How to create Image?</h3>
<p>All you have to do to create a valid image for this is have a docker image that accepts an enviromental variable called VNC_PASSWD that is the password for the web interface and that exposes port 80 as a way to access the web interface. Then just publish it on dockerhub and pull it onto the device you are running this on.</p>

View File

@@ -32,6 +32,7 @@
?>
<script type='text/javascript' src='index.js'></script>
<h1>Run Containers</h1>
<p>If a username is needed it will always be abc</p>
<table>
<tbody id='docker'>
<tr>

View File

@@ -367,9 +367,14 @@ Deny from all""")
writeLog(f"Container with id of {id} was stopped", 24)
elif x[1] == "starting": # Will start all containers that are neccessary
password = x[3]
if x[2] == "lscr.io/linuxserver/code-server":
newID = dockerClient.containers.run(x[2], detach=True, ports={'8443/tcp':x[5]}, remove=True, environment=["PUID=1000", "GUID=1000", "TZ=America/Detroit", f"PASSWORD={password}", f"SUDO_PASSWORD={password}", "DEFAULT_WORKSPACE=/config/workspace"]).attrs["Id"]
else:
if x[2] == "lscr.io/linuxserver/code-server": # Special case for code server.
newID = dockerClient.containers.run(x[2], detach=True, ports={'8443/tcp':x[5]}, remove=True, environment=["PUID=1000", "PGID=1000", "TZ=America/Detroit", f"PASSWORD={password}", f"SUDO_PASSWORD={password}", "DEFAULT_WORKSPACE=/config/workspace"]).attrs["Id"]
elif x[2][0:8] == "lscr.io/": # IS the default code for all linuxserver images.
newID = dockerClient.containers.run(x[2], detach=True, ports={'3000/tcp':x[5]}, remove=True, environment=["PUID=1000", "PGID=1000", "TZ=America/Detroit", "AUTO_LOGIN=false"], shm_size="1gb").attrs["Id"]
# Makes sure that the container has the right password
execID = dockerClient.api.exec_create(newID, f'bash -c "echo \"abc:{password}\" | chpasswd"', user="root")["Id"]
dockerClient.api.exec_start(execID)
else: # Default case
newID = dockerClient.containers.run(x[2], detach=True, ports={'80/tcp':x[5]}, remove=True, environment=[f"VNC_PASSWD={password}"]).attrs["Id"]
database.command(f"UPDATE docker SET action='started', id='{newID}' WHERE ID='{id}'")
writeLog(f"Container with id of {id} which changed to {newID} was started", 23)