Installation of imgproxy on Fedora CoreOS Latest

imgproxy is an open-source image resizing server that allows you to resize images in real-time. This tutorial will guide you step by step on how to install imgproxy on Fedora CoreOS Latest.

Prerequisites

  • A server running Fedora CoreOS Latest
  • SSH access to the server
  • Basic knowledge of Linux administration

Step 1 - Install Docker

The first step is to install Docker on the server. Docker is used to run imgproxy as a container. To install Docker, run the following command:

sudo dnf -y install docker

Step 2 - Start Docker

Next, start Docker and enable it to run at boot:

sudo systemctl start docker
sudo systemctl enable docker

Step 3 - Create imgproxy Configuration File

Create a configuration file for imgproxy. The configuration file defines the source of the images and the allowed transformations.

Create the configuration file as /etc/imgproxy.conf and add the following contents:

# imgproxy.conf

listener: ":8080"

source: "https://example.com"

cache:
  type: "fs"
  path: "/var/imgproxy/cache"

watermark:
  url: "https://imgproxy.net/static/watermark.png"
  opacity: 0.5

presets:
  "thumbnail":
    width: 200
    height: 200
    gravity: "noea"
    enlarge: true

security:
  allow_origin: "*"
  allow_credentials: true

You can edit the configuration to suit your specific needs.

Step 4 - Run imgproxy Container

Finally, we can run the imgproxy container using the configuration file. Run the following command:

sudo docker run --restart=always --name=imgproxy -p 8080:8080 -v /etc/imgproxy.conf:/opt/imgproxy/conf/imgproxy.conf sorz/imgproxy

The sudo docker run command runs the imgproxy container with the following options:

  • --restart=always: automatically start the container when the server is rebooted
  • --name=imgproxy: name the container imgproxy
  • -p 8080:8080: map the container port 8080 to the server port 8080
  • -v /etc/imgproxy.conf:/opt/imgproxy/conf/imgproxy.conf: mount the configuration file from /etc/imgproxy.conf to the container default configuration file
  • sorz/imgproxy: specifies the imgproxy container image from Docker Hub

Step 5 - Test imgproxy

imgproxy should now be running on the server. To test it, open your web browser and go to http://your-server-ip:8080 or http://your-domain-name:8080.

The imgproxy server should return a JSON response that tells you that the server is running. You can now use imgproxy to resize your images on the fly.

Congratulations, you've successfully installed imgproxy on Fedora CoreOS Latest!