如何从机器上完全删除 GitLab Server 的 Docker 容器?
How to completely erase a Docker container of GitLab Server from machine?
在为自托管 GitLab 服务器编写自动部署脚本时,我注意到我的卸载脚本没有(完全)删除 GitLab 服务器设置,也没有删除存储库。我希望卸载程序完全删除以前 GitLab 服务器安装的所有痕迹。
MWE
#!/bin/bash
uninstall_gitlab_server() {
gitlab_container_id=
sudo systemctl stop docker
sudo docker stop gitlab/gitlab-ce:latest
sudo docker rm gitlab/gitlab-ce:latest
sudo docker rm -f gitlab_container_id
}
uninstall_gitlab_server <some_gitlab_container_id>
观察到的行为
当运行安装脚本时,GitLab存储库被保留,GitLab root用户帐户密码从之前的安装中被保留。
预期行为
我希望 docker 容器和 GitLab 服务器数据将从设备中删除。因此,我希望 GitLab 服务器要求一个新的 root 密码,并且我希望它不会显示以前存在的存储库。
问题
如何完全删除安装了 GitLab 服务器:
sudo docker run --detach \
--hostname $GITLAB_SERVER \
--publish $GITLAB_PORT_1 --publish $GITLAB_PORT_2 --publish $GITLAB_PORT_3 \
--name $GITLAB_NAME \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
-e GITLAB_ROOT_EMAIL=$GITLAB_ROOT_EMAIL -e GITLAB_ROOT_PASSWORD=$gitlab_server_password \
gitlab/gitlab-ce:latest)
停止并删除容器不会删除您可能拥有的任何 host/Docker 卷 mounted/created。
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
你需要rm -rf $GITLAB_HOME
在为自托管 GitLab 服务器编写自动部署脚本时,我注意到我的卸载脚本没有(完全)删除 GitLab 服务器设置,也没有删除存储库。我希望卸载程序完全删除以前 GitLab 服务器安装的所有痕迹。
MWE
#!/bin/bash
uninstall_gitlab_server() {
gitlab_container_id=
sudo systemctl stop docker
sudo docker stop gitlab/gitlab-ce:latest
sudo docker rm gitlab/gitlab-ce:latest
sudo docker rm -f gitlab_container_id
}
uninstall_gitlab_server <some_gitlab_container_id>
观察到的行为
当运行安装脚本时,GitLab存储库被保留,GitLab root用户帐户密码从之前的安装中被保留。
预期行为
我希望 docker 容器和 GitLab 服务器数据将从设备中删除。因此,我希望 GitLab 服务器要求一个新的 root 密码,并且我希望它不会显示以前存在的存储库。
问题
如何完全删除安装了 GitLab 服务器:
sudo docker run --detach \
--hostname $GITLAB_SERVER \
--publish $GITLAB_PORT_1 --publish $GITLAB_PORT_2 --publish $GITLAB_PORT_3 \
--name $GITLAB_NAME \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
-e GITLAB_ROOT_EMAIL=$GITLAB_ROOT_EMAIL -e GITLAB_ROOT_PASSWORD=$gitlab_server_password \
gitlab/gitlab-ce:latest)
停止并删除容器不会删除您可能拥有的任何 host/Docker 卷 mounted/created。
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
你需要rm -rf $GITLAB_HOME