diff --git a/.gitignore b/.gitignore index d41346f..ff62927 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ p2p-rendering-computation p2prc config.json *.tgz +.vscode/ \ No newline at end of file diff --git a/server/docker/containers/docker-ubuntu-sshd-gpu/Dockerfile b/server/docker/containers/docker-ubuntu-sshd-gpu/Dockerfile new file mode 100644 index 0000000..06b8200 --- /dev/null +++ b/server/docker/containers/docker-ubuntu-sshd-gpu/Dockerfile @@ -0,0 +1,50 @@ +# ----------------------------------------------------------------------------- +# This is base image of Ubuntu LTS with SSHD service. +# +# Authors: Art567 +# Updated: Sep 20th, 2015 +# Require: Docker (http://www.docker.io/) +# ----------------------------------------------------------------------------- + +# Base system is the latest LTS version of Ubuntu. +# from consol/ubuntu-xfce-vnc + +# due to dependency issues vnc is still work in progress +from nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 + +# Switch to root user to install additional software +USER 0 + +# Make sure we don't get notifications we can't answer during building. +env DEBIAN_FRONTEND noninteractive + +# Prepare scripts and configs +add ./scripts/start /start + +# Download and install everything from the repos. +run apt-get -q -y update; apt-get -q -y upgrade && \ + apt-get -q -y install sudo openssh-server python3-pip && \ + mkdir /var/run/sshd + +# Set root password +run echo 'root:password' >> /root/passwdfile + +# Create user and it's password +run useradd -m -G sudo master && \ + echo 'master:password' >> /root/passwdfile + +# Apply root password +run chpasswd -c SHA512 < /root/passwdfile && \ + rm /root/passwdfile + +# Port 22 is used for ssh +expose 22 + +# Assign /data as static volume. +volume ["/data"] + +# Fix all permissions +run chmod +x /start + +# Starting sshd +cmd ["/start"] diff --git a/server/docker/containers/docker-ubuntu-sshd-gpu/README.md b/server/docker/containers/docker-ubuntu-sshd-gpu/README.md new file mode 100644 index 0000000..ee62e54 --- /dev/null +++ b/server/docker/containers/docker-ubuntu-sshd-gpu/README.md @@ -0,0 +1,72 @@ +Ubuntu LTS with SSH (Docker) +========= + +A Docker file to build a [docker.io] base container with Ubuntu LTS and a sshd service +[docker.io]: http://docker.io +Nice and easy way to get any server up and running using docker + + +Instructions +----------- + - Install Docker first. + Read [installation instructions] (http://docs.docker.io/en/latest/installation/). + + + - Clone this repository: + + `$ git clone https://github.com/art567/docker-ubuntu-sshd.git` + + + - Enter local directory: + + `$ cd docker-ubuntu-sshd` + + - Change passwords in Dockerfile: + + `$ vi Dockerfile` + + - Build the container: + + `$ sudo docker build -t art567/ubuntu .` + + + - Run the container: + + `$ sudo docker run -d=true --name=ubuntu --restart=always -p=2222:22 -v=/opt/data:/data art567/ubuntu /start` + + + - Your container will start and bind ssh to 2222 port. + + + - Find your local IP Address: + + `$ ifconfig` + + + - Connect to the SSH server: + + `$ ssh root@ -p 2222` + + + - If you don't want to deal with root: + + `$ ssh master@ -p 2222` + + +**VERY IMPORTANT!!!** +----------- + + **Don't forget to change passwords in Dockerfile before building image!** + + +Versions +----------- +Some branches represents Ubuntu versions. + +Branch `master` is always represented by latest Ubuntu LTS + + For example: + - 12.04 - Ubuntu 12.04 LTS + - 14.04 - Ubuntu 14.04 LTS + - 16.04 - Ubuntu 16.04 LTS + diff --git a/server/docker/containers/docker-ubuntu-sshd-gpu/scripts/start b/server/docker/containers/docker-ubuntu-sshd-gpu/scripts/start new file mode 100644 index 0000000..5286196 --- /dev/null +++ b/server/docker/containers/docker-ubuntu-sshd-gpu/scripts/start @@ -0,0 +1,11 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# docker-ubuntu-sshd /start script +# +# Authors: Art567 +# Updated: Sep 20th, 2015 +# ----------------------------------------------------------------------------- + + +# Run OpenSSH server in daemon mode +/usr/sbin/sshd -D diff --git a/server/docker/docker.go b/server/docker/docker.go index 10dd606..a23999a 100644 --- a/server/docker/docker.go +++ b/server/docker/docker.go @@ -82,6 +82,9 @@ func BuildRunContainer(NumPorts int, GPU string) (*DockerVM,error) { return nil,err } RespDocker.ImagePath = config.DockerFile + if GPU == "true" { + RespDocker.ImagePath = "/home/asleepyguy/p2p-rendering-computation/server/docker/containers/docker-ubuntu-sshd-gpu/" + } // Gets docker information from env variables cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) diff --git a/server/docker/kill-containers.sh b/server/docker/kill-containers.sh old mode 100644 new mode 100755