Docker install SQL Studio

Preface

The current image is built based on the installation package of the Linux version on the official website of SQL Studio. The tag of the image corresponds to the version of the official installation package. For example: v1.6.0 corresponds to the v1.6.0 version of the official Linux installation package. It will be generated later according to the official website. New version of the image. Attached is the official website installation package download address.

Mirror update record

2023/06/06 Generate a new image based on the v1.7.0 installation package

registry.cn-hangzhou.aliyuncs.com/levyy/sqlstudio:v1.7.0

Mirror description

exposed port

# 容器对外暴露的端口
18888

Mount volume

Here we only describe two main directories. One is the database file:/srv/app/sqlstudio/data. The database file is stored under this directory, which records the relevant tables required for system operation. The other is the log file:/srv. /app/sqlstudio/log, the system log files can be seen in this directory.

File mounting volume mounting example, ${data_path} and ${log_path} represent the destination path of the mounting host.

-v ${data_path}:/srv/app/sqlstudio/data
-v ${log_path}:/srv/app/sqlstudio/log

Install image

Pull image

docker pull registry.cn-hangzhou.aliyuncs.com/levyy/sqlstudio:v1.6.0

boot image

It is recommended to start the image by mounting a volume to ensure that data is not lost, otherwise the data inside will be lost once the container is deleted.

Simple start

docker run -d --name sqlstudio -p 18888:18888 registry.cn-hangzhou.aliyuncs.com/levyy/sqlstudio:v1.6.0

Mount volume startup

Before mounting the data volume, you need to start the container and copy the internal database files to the corresponding mounting directory. If you start the container directly, an error will be reported due to missing related tables, causing the container to fail to start.

Start container

docker run -d --name sqlstudio -p 18888:18888 registry.cn-hangzhou.aliyuncs.com/levyy/sqlstudio:v1.6.0

Copy database

docker cp sqlstudio:/srv/app/sqlstudio/data/sqlite.db ${data_path}

Delete image

docker rm -f sqlstudio

Restart and replace ${data_path} and ${log_path} with the corresponding paths.

docker run -d \
--name sqlstudio \
-p 18888:18888 \
-v ${data_path}:/srv/app/sqlstudio/data \
-v ${log_path}:/srv/app/sqlstudio/log \
--restart always \
registry.cn-hangzhou.aliyuncs.com/levyy/sqlstudio:v1.6.0

View log

docker logs -f sqlstudio

 If the words "started successfully" appear in the log, it means that the container was started successfully and you can use it happily.

Visit SQL Studio

You can connect to SQL Studio according to the host IP and port where the container is located.

ip:port
# 示例
localhost:18888

Enter the initial username: maicong. No need to enter the password. The login is successful.

 Finish

The above is the entire process of installing and starting the SQL Studio mirror version. For specific usage details of SQL Studio, please refer to the instructions on the official website. If you have any questions, please feel free to communicate.

Supongo que te gusta

Origin blog.csdn.net/LSW_JAVADP/article/details/130931921
Recomendado
Clasificación