opened image

VPN Shadowsocks with X-Ray VMESS, VLESS with XTLS (GUI)

Docker has become one of the most popular tools for developers and system administrators due to its ability to isolate applications in containers. In this article, we will discuss how to install and configure X-UI in Docker on an Ubuntu server.

Step 1: Installing Docker and Docker Compose

Before we begin working with X-UI, we need to install Docker and Docker Compose. Follow the instructions below:

 

Installing the necessary dependencies:

apt-get install ca-certificates curl gnupg

install -m 0755 -d /etc/apt/keyrings

 

Adding the Docker repository:

 

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

chmod a+r /etc/apt/keyrings/docker.gpg

echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

 

Updating the repositories and installing Docker:

 
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

systemctl enable docker

 

Installing Docker Compose:

 
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

 

Step 2: Installing and Configuring X-UI

Now that we have Docker installed, we can proceed to installing X-UI.

Creating the file docker-compose.yaml:

 
vim docker-compose.yaml

 

Adding the following configuration code to the file:

 

version: "3.9"

services:
  xui:
    image: alireza7/x-ui
    container_name: x-ui
    volumes:
      - $PWD/db/:/etc/x-ui/
      - $PWD/cert/:/root/cert/
    environment:
      XRAY_VMESS_AEAD_FORCED: "false"
    tty: true
    network_mode: host
    restart: unless-stopped

 

Launching the X-UI container:

docker-compose up -d

 

After executing these commands, X-UI will be installed and running on your server. Note that due to the network_mode: host parameter, the container will use the host's network stack directly, making its configuration easier but removing the possibility of port forwarding.

 


Panel access data:

 

  • Address: Server IP:54321
  • Login: admin
  • Password:admin


If you have changed the port, then to find out which one is currently in use, run the following command:

 

docker logs x-ui | grep "http on"

 

 

Conclusion

Docker provides a convenient and flexible way to manage applications on a server. X-UI, installed in Docker, offers ease of deployment and management, providing a reliable and stable solution for your infrastructure. Follow this guide, and you will be able to quickly and easily start working with X-UI on your Ubuntu server.