Giter Site home page Giter Site logo

simplehttpserver's Introduction

Simple HTTP server

Very simple http server in Docker to expose local files to http request, example of such a request

image

Docker image is available on https://hub.docker.com/r/salvq/simplehttpserver

Steps

  1. Create host folder for your files you plan to expose via http server, folder path example /share/Container/simplehttpserver
  2. Copy the files to the host folder, example of dump.txt file location
[test@NASEFCasd2 simplehttpserver]$
[test@NASEFCasd2 simplehttpserver]$ pwd
/share/Container/simplehttpserver
[test@NASEFCasd2 simplehttpserver]$ ls -ll
total 67696
-rw-rw-rw- 1 user   everyone             32 2023-08-03 08:23 dump.txt
[test@NASEFCasd2 simplehttpserver]$
  1. Host folder /share/Container/simplehttpserver is mapped via docker-run or decoker-compose.yaml below, change it accordingly based on your environment
  2. Folder /simplehttpserver must stay unchanged, this docker image folder is used by python script and is linked with your host folder /share/Container/simplehttpserver
  3. You may change your exposure ports and network based on your environment

Run server via docker-run

docker run -d \
--name simplehttpserver \
--network=others \
--ip 172.18.5.44 \
--restart=always \
-p 8000:8080 \
-v /share/Container/simplehttpserver:/simplehttpserver \
salvq/simplehttpserver:1.2.0

Run server via docker-compose.yaml

version: '3'
services:
  simplehttpserver:
    image: salvq/simplehttpserver:1.2.0
    container_name: simplehttpserver
    restart: unless-stopped
    ports:
      - "8000:8000"
    volumes:
      - /share/Container/simplehttpserver:/simplehttpserver
    networks:
      others:
         ipv4_address: 172.18.5.44
networks:
  others:
    external: true

Connect to docker container

[test@NASEFCasd2 simplehttpserver]$
[test@NASEFCasd2 simplehttpserver]$ docker exec -it simplehttpserver bash
simple@cd0b998d23cd:~$ pwd
/script
simple@cd0b998d23cd:~$ ls -ll
total 4
-rw-rw-rw- 1 root root 343 Jul 16 10:50 simple_server.py
simple@cd0b998d23cd:~$ exit
exit
[test@NASEFCasd2 simplehttpserver]$

simplehttpserver's People

Contributors

salvq avatar

Watchers

 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.