This guide provides a complete set of instructions to create and use a Docker container with essential networking and debugging tools installed. Adjust the commands as needed for your specific environment and requirements.
Step-by-Step Guide for Setting Up Open WebUI with Cloudflare Tunnel
This guide will walk you through setting up and running the Open WebUI and Cloudflare Tunnel containers on Docker, ensuring they are connected to a custom Docker network (docker_bridge
).
Step 1: Ensure the Custom Network Exists
If you haven’t already created the custom Docker network (docker_bridge
), create it:
docker network create docker_bridge
This ensures that both containers (open-webui
and cloudflared
) can communicate on the same network.
Step 2: Run the Open WebUI Container
Ensure your open-webui
container is running and connected to the custom network (docker_bridge
):
docker run -d \
-p 3000:8080 \
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
--name open-webui \
--restart always \
--network docker_bridge \
ghcr.io/open-webui/open-webui:main
-d
: Runs the container in detached mode.-p 3000:8080
: Maps port 3000 on the host to port 8080 in the container.--add-host=host.docker.internal:host-gateway
: Resolveshost.docker.internal
to the Docker host’s gateway IP.-v open-webui:/app/backend/data
: Mounts a volume namedopen-webui
for persistent data storage.--name open-webui
: Assigns the name “open-webui” to the container.--restart always
: Restarts the container automatically if it stops.--network docker_bridge
: Connects the container to thedocker_bridge
network.ghcr.io/open-webui/open-webui:main
: Specifies the image to use (ghcr.io/open-webui/open-webui:main
).
Step 3: Run the Cloudflare Container
Use the following command to start the Cloudflare cloudflared
container, ensuring it is on the same custom network (docker_bridge
) and configured to connect to the open-webui
container:
docker run -d \
--network docker_bridge \
--name cloudflared \
cloudflare/cloudflared:latest tunnel --no-autoupdate run --token <your-cloudflare-token>
Replace <your-cloudflare-token>
with your actual Cloudflare Tunnel token.
-d
: Runs the container in detached mode.--network docker_bridge
: Connects the container to thedocker_bridge
network.--name cloudflared
: Assigns the name “cloudflared” to the container.cloudflare/cloudflared:latest
: Specifies the image to use (cloudflare/cloudflared:latest
).tunnel --no-autoupdate run --token <your-cloudflare-token>
: Starts the Cloudflare Tunnel with your token.
Step 4: Verify and Test
After starting the containers, verify their status and test connectivity:
-
Check Container Status:
Ensure both containers (
open-webui
andcloudflared
) are running:docker ps
-
Inspect Network Connections:
Verify both containers are connected to the
docker_bridge
network:docker network inspect docker_bridge
-
Check Connectivity:
From the
cloudflared
container, test connectivity to theopen-webui
container:docker exec -it cloudflared /bin/sh -c 'curl http://open-webui:8080'
This command runs
curl
inside thecloudflared
container to accessopen-webui
on port 8080. -
Access Open WebUI via Cloudflare Tunnel:
Use your Cloudflare Tunnel URL to access the
open-webui
application.
Complete Command Sequence
Here is the complete set of commands to set up and test the Open WebUI and Cloudflare Tunnel:
# Step 1: Create the custom Docker network
docker network create docker_bridge
# Step 2: Run the Open WebUI container
docker run -d \
-p 3000:8080 \
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
--name open-webui \
--restart always \
--network docker_bridge \
ghcr.io/open-webui/open-webui:main
# Step 3: Run the Cloudflare container (replace <your-cloudflare-token> with your actual token)
docker run -d \
--network docker_bridge \
--name cloudflared \
cloudflare/cloudflared:latest tunnel --no-autoupdate run --token <your-cloudflare-token>
# Verify and Test
# Step 4: Check container status
docker ps
# Step 5: Inspect network connections
docker network inspect docker_bridge
# Step 6: Check connectivity from cloudflared to open-webui
docker exec -it cloudflared /bin/sh -c 'curl http://open-webui:8080'
This guide provides a comprehensive set of instructions to set up and test the Open WebUI and Cloudflare Tunnel containers on Docker, ensuring they are connected to a custom network and verifying their connectivity. Adjust the commands as needed for your specific environment and requirements.
Step-by-Step Guide for Creating a Temporary Docker Container with Networking and Debugging Tools
This guide will walk you through creating a Docker container with networking and debugging tools (iputils-ping
, net-tools
, curl
, telnet
, and nmap
) installed, using the provided command.
Step 1: Ensure the Custom Network Exists
If you haven’t already created the custom Docker network (docker_bridge
), create it:
docker network create docker_bridge
This ensures that the container can communicate on the same network with other containers.
Step 2: Run the Docker Container
Run the following command to start a Docker container with an interactive shell and install the necessary tools:
docker run -ti --rm \
--network docker_bridge \
--name ubuntu \
ubuntu:latest /bin/bash -c ' \
apt update && \
apt install -y iputils-ping net-tools curl telnet nmap && \
/bin/bash'
-ti
: Starts the container in interactive mode with a terminal.--rm
: Automatically removes the container when it exits.--network docker_bridge
: Connects the container to thedocker_bridge
network.--name ubuntu
: Assigns the name “ubuntu” to the container.ubuntu:latest
: Uses the latest Ubuntu image from Docker Hub./bin/bash -c '...'
: Runs a bash shell and executes the commands within the quotes.
Step 3: Verify Installations
After the container starts and the packages are installed, you can verify that the tools are working correctly:
- Test
ping
:ping google.com
- Test
ifconfig
(fromnet-tools
):ifconfig
- Test
curl
:curl google.com
- Test
telnet
:telnet google.com 80
- Test
nmap
:nmap google.com
Step 4: Exit the Container
To exit the Docker container’s shell, type exit
.
exit
Complete Command
Here is the complete command to create the Docker container and install the required packages:
docker run -ti --rm \
--network docker_bridge \
--name ubuntu \
ubuntu:latest /bin/bash -c ' \
apt update && \
apt install -y iputils-ping net-tools curl telnet nmap && \
/bin/bash'
Explanation of the Commands
-
Ensure the Custom Network Exists:
docker network create docker_bridge
This ensures both containers can communicate on the same network.
-
Run the Docker Container:
docker run -ti --rm \ --network docker_bridge \ --name ubuntu \ ubuntu:latest /bin/bash -c ' \ apt update && \ apt install -y iputils-ping net-tools curl telnet nmap && \ /bin/bash'
- This command starts a Docker container with an interactive shell.
- It connects the container to the
docker_bridge
network. - Installs
iputils-ping
,net-tools
,curl
,telnet
, andnmap
inside the container. - Starts a bash shell inside the container for further interaction.
Verify and Test
-
Check Container Status:
Ensure the container is running:
docker ps
-
Inspect Network Connections:
Verify the container is connected to the
docker_bridge
network:docker network inspect docker_bridge
-
Check Connectivity:
From the Docker container, test the installed tools:
- Test
ping
:ping google.com
- Test
ifconfig
:ifconfig
- Test
curl
:curl google.com
- Test
telnet
:telnet google.com 80
- Test
nmap
:nmap google.com
- Test
-
Access Open WebUI via Cloudflare Tunnel:
Use your Cloudflare Tunnel URL to access the
open-webui
application.