Giter Club home page Giter Club logo

ubuntu-dev-workspace's Introduction

SSH-Enabled Ubuntu Docker Image

Docker Image Deployment Docker Pulls Maintenance

This Docker image provides an Ubuntu 22.04 base with SSH server enabled. It allows you to easily create SSH-accessible containers via SSH keys or with a default username and password.

Usage

Cloning the Repository

To get started, clone the GitHub repository containing the Dockerfile and scripts:

git clone https://github.com/aoudiamoncef/ubuntu-sshd
cd ubuntu-sshd

Building the Docker Image

Build the Docker image from within the cloned repository directory:

docker build -t my-ubuntu-sshd:latest .

Running a Container

To run a container based on the image, use the following command:

docker run -d -p host-port:22 -e SSH_USERNAME=myuser -e PASSWORD=mysecretpassword -e AUTHORIZED_KEYS="$(cat path/to/authorized_keys_file)" my-ubuntu-sshd:latest
  • -d runs the container in detached mode.
  • -p host-port:22 maps a host port to port 22 in the container. Replace host-port with your desired port.
  • -e SSH_USERNAME=myuser sets the SSH username in the container. Replace myuser with your desired username.
  • -e PASSWORD=mysecretpassword sets the SSH user's password in the container. Replace mysecretpassword with your desired password.
  • -e AUTHORIZED_KEYS="$(cat path/to/authorized_keys_file)" sets authorized SSH keys in the container. Replace path/to/authorized_keys_file with the path to your authorized_keys file.
  • my-ubuntu-sshd:latest should be replaced with your Docker image's name and tag.

SSH Access

Once the container is running, you can SSH into it using the following command:

ssh -p host-port myuser@localhost
  • host-port should match the port you specified when running the container.
  • Use the provided password or SSH key for authentication, depending on your configuration.

Note

  • If the AUTHORIZED_KEYS environment variable is empty when starting the container, it will still launch the SSH server, but no authorized keys will be configured. You have to mount your own authorized keys file or manually configure the keys in the container.

License

This Docker image is provided under the MIT License.

ubuntu-dev-workspace's People

Contributors

aoudiamoncef avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.