Clone the image
git clone https://github.com/dartharrmi/Calcudocker.git /your/path/for/saving
Building the image
After you have cloned the image, navigate to the folder where you just put it and run the following command:
docker build -t aes_calculator .
After that, the image will be listed by Docker:
Running the image
Run the following command:
docker run -p 49160:8080 -d aes_calculator
Port 49160 is the one recommended, though you can use any port available in your own machine.
You can theck that the image is running with the following command:
docker ps
which should produce an output like this:
Testing
The API exposes 4 methods, each of them performs each one of the basic arithmetic operations, just pass your numbers as path parameters. Is good to notice that only the division needs two numbers:
- Addition: 127.0.0.1:49160/_add/firstNumber/secondNumber/thirdNumber/andSoOn
- Subtraction: 127.0.0.1:49160/_substract/firstNumber/secondNumber/thirdNumber/andSoOn. Based on your inputs, it might produce a negative output.
- Multiplication: 127.0.0.1:49160/_multiply/firstNumber/secondNumber/thirdNumber/andSoOn
- Division: 127.0.0.1:49160/_division/firstNumber/secondNumber
There are several ways to check that the server running within the image is working, one might be by using the curl
command, run this and you should get a similar output:
And you can also use a client, like Postman:
Calcudocker in DockerHub
A more convenient and straightforward way to run the image is pulling directly from DockerHub 🤓, just run this command:
docker run -p 49160:8000 -d dartharrmi/calcudocker:v0.0.1
Again, check the server is running with methods described above 🙃.