Code Monkey home page Code Monkey logo

docker-test's Introduction

docker-test

Sample docker image to test various scenarios with Docker.

CircleCI XO code style


Motivation

Just another "Hello World" docker image to be used in various experiments ...

Note: This Docker image is definitely not designed to be used in a production environment as it could result into serious security issues. But it's nice to be added to your toolbox when playing with Docker/Docker Swarm/Kubernetes, etc.

Usage

$ docker pull stefanwalther/docker-test
$ docker run -it -p 3000:3000 stefanwalther/docker-test

With docker-compose

version: '3.3`
services:
  hello-world:
    image: stefanwalther/docker-test
    ports:
      - 3000:3000
    environment:
      - PORT=3000
        

Configuration

  • PORT - Port of the web service, defaults to 3000.

Endpoints

/

Just returns a "Hello World":

{
  "text": "Hello World"
}

/health-check

Returns a typical health-check, useful to test health-checks in a microservice environment.

{
  "ts": "2017-12-07T22:25:34.489Z",
  "version": "0.3.1",
  "name": "docker-test",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/stefanwalther/docker-test.git"
  }
}

/cmd

Execute any command on the machine and get the result.

Parameters:

  • def - The command to execute.

Usage:

# Process ls -la
$ curl http://localhost:3000/cmd/?def=ls%20-la

Examples:

  • ls -la - list the directory
  • curl -o -I -L -s -w "%{http_code}\n" http://localhost:3000/health-check - Get the Http status code of the health-check

/cmd-cron

Create a cron job, executing a command.

Parameters:

Usage:

# Process "echo foo" with the following cron def: "* * * * *" (every minute)
$ curl http://localhost:3000/cmd-cron?def=echo%20foo&cron=*%20*%20*%20*%20*

Experiments

Multistage Builds

References:

About

Author

Stefan Walther

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. The process for contributing is outlined below:

  1. Create a fork of the project
  2. Work on whatever bug or feature you wish
  3. Create a pull request (PR)

I cannot guarantee that I will merge all PRs but I will evaluate them all.

License

Copyright © 2020, Stefan Walther.

MIT

docker-test's People

Contributors

stefanwalther avatar renovate-bot 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.