Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple REST web server in docker container

I would like a small web server that offers a REST api, that external tools can call to store very small amount of data (either write or read data) and offer a html page to display that data.

The data would be a simple matrix (2d table). I was planning on having external tools sending a single entry of the data with the REST api (one square of the table) in json format (it will contain only about three strings). Maybe store the data in a xml file.

I would like that web server to be in a docker container, so it can be deployed easily in our cloud environment (using a volume so in does not lose data). It would run under a Linux environment.

I know this is kind of a broad question, but I would like to know what technology to use for that case. Should I use Python? I don't actually know how to do that. I did docker containers in the past for other things, did some REST api in JAVA, but nothing like this.

Do you have suggestions or resources?

like image 747
Amaranth Avatar asked Feb 09 '16 21:02

Amaranth


People also ask

Is Docker good for web server?

Docker has become an extremely popular way to configure, save, and share server environments using containers. Because of this, installing an application or even a large stack can often be as simple as running docker pull or docker run .

Does Docker have a REST API?

The Docker Engine API is a RESTful API accessed by an HTTP client such as wget or curl , or the HTTP library which is part of most modern programming languages.

Can you host a web app on Docker?

Docker Hub is like the GitHub of Docker Containers. There are thousands of apps and examples you can use. To set up your own public or private repository to start deploying your apps, just go to the Docker Hub website. You can use the Docker hub to push and pull changes in your app to different machines.


1 Answers

you can use Python Flask to easily create a REST service and containerize . A tutorial available here Also you can try out spring-boot using which you can package a web container like tomcat along with which will be similar to your requirement . example

like image 50
Saril Sudhakaran Avatar answered Oct 24 '22 07:10

Saril Sudhakaran