Setting up a Docker environment on an OVH server

A quick, reproducible tutorial for getting a Dockerized app running on a fresh OVH instance, from generating an SSH key to serving a Django app on port 8000.

1. Generate an SSH key

ssh-keygen -b 4096

This creates a 4096-bit SSH key pair for secure authentication.

2. Connect to your instance

ssh -i ~/.ssh/keyname root@XxX.XxX.XxX.XxX

Replace keyname with your SSH key filename and XxX.XxX.XxX.XxX with your instance’s IP address.

3. Install Docker on Ubuntu

First, update the system and install prerequisites:

sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings

Add Docker’s GPG key:

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Configure the Docker repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update the package list and install Docker:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

4. Verify the Docker installation

sudo docker run hello-world

This command downloads a test image and runs it to verify the installation.

5. Clone your repository

git clone https://JesusGF1:personalaccesstoken@github.com/JesusGF1/reponame.git

Replace personalaccesstoken with your actual GitHub personal access token and reponame with your repository name.

6. Build and run the Docker container

Build the Docker image:

docker build -t reponame .

Run the container interactively:

docker run -it -p 8000:8000 reponame /bin/bash

7. Set up the development environment

Install the required tools and dependencies:

cd /usr/bin
wget whatever you need
pip install package1==4.1 package2==1.83
pip install -e /folder

8. Run the Django server

python /manage.py runserver 0.0.0.0:8000 --settings=web.settings.development

Your application should now be running and accessible on port 8000.


<
Previous Post
TabNet: a deep learning architecture for interpretable tabular data
>
Next Post
Why do omic foundation models keep failing?