Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Exposing Docker Build Capabilities to LAN via 1Panel

Tech 1

Our server management team installed 1Panel (community edition v1.10.10-lts) and wants all small development projects deployed via Docker. As a Windows developer without a local Docker environment, the first step is configuring a shared Docker image build capability over the LAN.

Docker's core functions are building lightweight virtual machine images and running them as containers. Its build capability can serve both local and LAN clients. While 1Panel simplifies file editing, exposing Docker's build ability does not strictly require it.

To expose the Docker build service, we need to configure network listening so remote machines can send build commands. Three common configuration files are involved: /etc/default/docker, /usr/lib/systemd/system/docker.service, and /etc/docker/daemon.json. The approach is to check each file sequentially, modify the first one that exists, and then restart Docker.

1. Check if Docker Port is Already Open

Docker typically uses port 2375 for unencrypted remote access. We can verify with the command netstat -tulnp in the 1Panel terminal ("Host" → "Terminal"). If already open, the output includes:

tcp6    0    0 :::2375        :::*           LISTEN      2378/dockerd

2. Find and Modify the Configuration File

Only one file needs to be changed. Check in order:

File 1: /etc/default/docker – This file did not exist on our system.

File 2: /usr/lib/systemd/system/docker.service – Existed and was modified. Under the [Service] section, the ExecStart line updated to include the -H flags:

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutStartSec=0
RestartSec=2
Restart=always

File 3: /etc/docker/daemon.json – Existed but was not modified.

3. Restart Docker

Restart the Docker daemon (not individual containers) using:

sudo service docker restart

4. Confirm Port Status

Rerun netstat -tulnp to verify that port 2375 is now listening (if it wasn't already).

Once exposed, developers can use Maven Docker plugins (e.g., docker-maven-plugin) to remotely invoke the image build process from their IDEs.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.