USING IRONSECUREDOC

Docker Compose Build (Developer Tutorial)

Published December 16, 2024
Share:

What is Docker?

Docker is an open-source system that makes it easier to develop, deploy, and run applications in a system using containerization. Containers are ultra-lightweight portable units containing both an application and its dependencies so that they run uniformly everywhere, from a developer's machine to production servers. Compared to traditional virtual machines, containers share the kernel of the host's operating system, so they are much faster and more effective.

Docker Compose Build (Developer Tutorial): Figure 1

This means offering a virtualized template in the form of Docker images to create and manage this set of containers. Additionally, the platform comprises the Docker Hub, which represents a kind of container image repository. The beauty of this technology lies in its potential ease of scaling, portability, and efficiency, which is why it has gained popularity among many DevOps and cloud-based development workflows.

How does Docker work?

  • The Docker Daemon takes orders through the Docker Client in the form of a docker build, docker pull, or even a docker run.
  • Docker Daemon creates, manages, and monitors containers. It also downloads the appropriate Docker images from a private registry or the Docker Registry, such as Docker Hub.
  • The daemon uses the image it has downloaded to create an isolated Container or running instance of the application.
  • As with a container, the containers share the host machine's operating system kernel but are isolated from other containers. This allows the program to be executed within its own environment, just with its set of requirements.
+--------------------+
|   Docker Client     |
|  (CLI/API)          |
+--------------------+
          |
          v
+--------------------+                +---------------------+
|   Docker Daemon    |   -------->    |   Docker Registry    |
| (runs containers,  |                | (stores images)      |
|  manages resources)|                +---------------------+
+--------------------+
          |
          v
+---------------------+
|      Container      |  
|  (App Instance)     |
+---------------------+
          |
          v
+---------------------+
| Docker Image        |  
| (Blueprint for App) |
+---------------------+
+--------------------+
|   Docker Client     |
|  (CLI/API)          |
+--------------------+
          |
          v
+--------------------+                +---------------------+
|   Docker Daemon    |   -------->    |   Docker Registry    |
| (runs containers,  |                | (stores images)      |
|  manages resources)|                +---------------------+
+--------------------+
          |
          v
+---------------------+
|      Container      |  
|  (App Instance)     |
+---------------------+
          |
          v
+---------------------+
| Docker Image        |  
| (Blueprint for App) |
+---------------------+
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'+--------------------+ | Docker Client | | (CLI/API) | +--------------------+ | v +--------------------+ +---------------------+ | Docker Daemon | -------- > | Docker Registry | | (runs containers, | | (stores images) | | manages resources)| +---------------------+ +--------------------+ | v +---------------------+ | Container | | (App Instance) | +---------------------+ | v +---------------------+ | Docker Image | | (Blueprint for App) | +---------------------+
VB   C#

What is Docker compose?

With Docker Compose, you can manage a multi-container Docker application in the simplest way possible. It lets you define multiple services by referencing a docker-compose.yml file. In the YAML file(or yml file), you may include configuration settings for the service d, such as the Docker image you will use, environment variables, networks, or volumes. You can start, stop, and manage all your containers in the application by a single command using Docker Compose: docker-compose up or docker-compose down.

+--------------------------+
|   docker-compose.yml      |  (Configuration file)
+--------------------------+
            |
            v
+----------------+    +----------------+    +----------------+
|   Service 1    |    |   Service 2    |    |   Service 3    |
|  (e.g. web)    |    |  (e.g. db)     |    |  (e.g. cache)  |
+----------------+    +----------------+    +----------------+
            |                  |                   |
            -----------------------------------------
                         Docker Application
+--------------------------+
|   docker-compose.yml      |  (Configuration file)
+--------------------------+
            |
            v
+----------------+    +----------------+    +----------------+
|   Service 1    |    |   Service 2    |    |   Service 3    |
|  (e.g. web)    |    |  (e.g. db)     |    |  (e.g. cache)  |
+----------------+    +----------------+    +----------------+
            |                  |                   |
            -----------------------------------------
                         Docker Application
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'+--------------------------+ | docker-compose.yml | (Configuration file) +--------------------------+ | v +----------------+ +----------------+ +----------------+ | Service 1 | | Service 2 | | Service 3 | | (e.g.web) | | (e.g.db) | | (e.g.cache) | +----------------+ +----------------+ +----------------+ | | | ----------------------------------------- Docker Application
VB   C#

It's particularly useful for complex applications, such as microservices, with hundreds of container instances running together. These could include web servers, databases, and even caches. This is why Docker Compose is very efficiently used in development, testing, and production environments.

Create a New React JS application With Dot core

Here are the steps to create a new Visual Studio React application with an ASP.NET Core backend and add support for Docker. This is an extensive guide:

Prerequisites

  • Visual Studio: Make sure that you have Visual Studio 2022 or newer installed with all its workloads:
  • Web development workload and ASP.NET
  • Workload for Node.js development (React)
  • Docker Support (download by running the Visual Studio installer)
  • Docker Desktop: Docker Desktop should be installed and running.

Create New Project

Open Visual Studio and choose New Project from the menu.

Docker Compose Build (Developer Tutorial): Figure 2

Find and choose React and ASP.NET Core Web Application from the "Create a new project" dialog. Then press the Next button.

Docker Compose Build (Developer Tutorial): Figure 3

Decide on a project name. Select the solution name and the location where the project will be saved. Then press the Next button.

Docker Compose Build (Developer Tutorial): Figure 4

Make sure Docker Enable is selected. Select the desired framework. Click Create after that.

Docker Compose Build (Developer Tutorial): Figure 5

Once the project is created, you can add a Docker compose file to it by right-clicking on the project node and selecting Add > Docker Support.

Docker Compose Build (Developer Tutorial): Figure 6

Then, Select the container name and type and click ok.

Docker Compose Build (Developer Tutorial): Figure 7

Now that the new create project is added to the docker container, we can run docker-compose through the docker application. Below is the sample output generated from the react JS client-side code.

Docker Compose Build (Developer Tutorial): Figure 8

Below is the API server-side code that runs from the docker container.

Docker Compose Build (Developer Tutorial): Figure 9

IronSecureDoc

IronSecureDoc for Docker enables developers to efficiently add a secure document processing capability to their containerized applications. Now that you can use Docker, you get the opportunity to encapsulate your ASP.NET Core application with IronSecureDoc within a uniform environment that promotes easier deployment and scaling. To get it running, you build a Dockerfile that composes your ASP.NET Core application using the IronSecureDoc library and possibly other installation scripts or configurations necessary to get things working.

Docker Compose Build (Developer Tutorial): Figure 10 - IronSecureDoc

Additionally, it provides a docker-compose.yml file that outlines service dependencies and environment variables and mapped ports for accessing it. This makes handling document security tasks much more accessible so your application can run efficiently and effectively in an environment other than the one used during development or production. Installation and Configuration of IronSecureDoc Like with Docker, the proper installation and configuration of IronSecureDoc will be necessary to effectively realize its capabilities: document encryption, redaction, etc.

Install and Running IronsecureDoc

To retrieve the IronSecureDoc Docker image from the repository, use this command in a Command Prompt or open terminal window.

docker pull ironsoftwareofficial/ironsecuredoc
docker pull ironsoftwareofficial/ironsecuredoc
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'docker pull ironsoftwareofficial/ironsecuredoc
VB   C#

Docker Compose Build (Developer Tutorial): Figure 11

After the Docker container has pulled an image, we can use another command to launch IronSecureDoc, another container that is now operating.

docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
VB   C#

Docker Compose Build (Developer Tutorial): Figure 12

Using IronSecuredoc with Docker Container

IronSecureDoc's REST API allows users to redact, certify, and encrypt documents upon installation and launch in Docker; this feature is also mentioned elsewhere. Here's a link to the documentation and API endpoints.

Docker Compose Build (Developer Tutorial): Figure 13

For example, to submit a document for encryption, you can send a POST request to the IronSecureDoc API:

curl -X 'POST' \
  'http://localhost:8080/v1/document-services/pdfs/encrypt?user_password=demo' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'pdf_file=@test.pdf;type=application/pdf'
curl -X 'POST' \
  'http://localhost:8080/v1/document-services/pdfs/encrypt?user_password=demo' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'pdf_file=@test.pdf;type=application/pdf'
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'curl -X 'POST' \ 'http: -H 'accept: */ *' \ -H 'Content-Type: multipart/form-data' \ -F 'pdf_file=@test.pdf;type=application/pdf'
VB   C#

Doing this will send the document to IronSecureDoc, which will encrypt it appropriately.

Conclusion

In short, the Docker Compose integration with IronSecureDoc goes a long way toward the efficiency and reliability of applications that need to process secure documents in development and deployment. What the help of using the Docker Compose is good at is efficient management of multiple-container applications in a manner that would allow other services and dependencies to be orchestrated with the IronSecureDoc. This would further guarantee consistency in the development environment, simplify many configuration tasks, and improve scalability across diverse deployment environments.

Moreover, all these features of documents, including encryption, redaction, and secure sharing, can be well exploited within such a containerized architecture. In short, the developer workflow gets immense value by combining Docker Compose and IronSecureDoc, which streamlines the development procedures and provides a secure, efficient, and maintainable solution for sensitive document-related tasks in modern applications. To find out more about Ironsecuredoc licensing, click this page. Click this link to learn more about Iron Software's many product offerings.

< PREVIOUS
Docker Compose Environment Variables (Developer Tutorial)
NEXT >
How to Install Portainer (Developer Tutorial)

Ready to get started? Version: 2024.10 just released

Free DownloadView Licenses >