The imagor is an open-source image processing server designed to handle image manipulation tasks like resizing, cropping, filtering, and converting images. It is a high-performance solution, written in Go programming language.
This tutorial explains how to install imagor inside a Docker container on Linux. Commands have been tested on Ubuntu.
Prepare environment
Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.
Install imagor
- Host network
Run the following command to create a container for imagor that uses host network:
docker run -d --name=imagor --restart=always --network=host \
shumc/imagor -imagor-unsafe
- User-defined bridge network
User-defined bridge network can be used for listening on different port. By default, imagor service is listening on port 8000. It can be changed with -p
option.
docker network create app-net
docker run -d --name=imagor --restart=always --network=app-net \
-p 8080:8000 \
shumc/imagor -imagor-unsafe
Testing imagor
To use imagor, construct a URL that specifies the desired image operations followed by the image's source URI. For example:
http://192.168.0.227:8000/unsafe/fit-in/200x200/https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png
unsafe
- indicates that the image can be processed without a URL signature (for development purposes).fit-in/200x200
- specifies the operation to fit the image within a 200x200 pixel box, maintaining its aspect ratio.
The imagor processes the image according to the operations specified in the URL and returns the modified image.
Uninstall imagor
To completely remove imagor, remove its container:
docker rm --force imagor
Remove imagor image:
docker rmi shumc/imagor
If a user-defined bridge network was created, you can delete it as follows:
docker network rm app-net
Leave a Comment
Cancel reply