我的调试是在 VS code 中设置的,我可以在通过 launch.json 配置运行的文件中命中断点,但无法在使用 PIP 安装的包中命中断点。如何在这些包文件中获取断点?
我正在尝试创建一个新的Docker镜像,该镜像不再使用来自正在使用图像的正在运行的容器中的卷.卷是使用docker-compose文件而不是Dockerfile创建的.问题是,当我通过新的docker-compose.yml文件启动一个新容器时,它仍然有映射的卷.我仍然需要保留这些卷和使用它们的原始容器/图像.此外,如果可能,我想继续使用相同的泊坞窗图像,只需添加新版本,或:最新.这是我使用的步骤:
现有图像的新版本:
docker commit <image id> existingImage:new-version
Run Code Online (Sandbox Code Playgroud)
从当前运行的容器创建一个新图像:
docker commit <Image ID> newimage
Run Code Online (Sandbox Code Playgroud)
创建没有定义卷的新docker-compose.yml,并使用不同的项目名称运行docker-compose
docker-compose -p <new project name>
Run Code Online (Sandbox Code Playgroud)
在没有docker-compose的情况下运行,只需使用docker run:
docker run -d -p 8093:80 <img>:<version>
Run Code Online (Sandbox Code Playgroud)
每当我运行这些卷的任何组合时,仍然会从原始图像映射卷.所以我的问题是,如何从曾经映射过卷的图像创建一个容器,但我不想再使用这些卷?
编辑: 我尝试过的其他内容:
编辑2: 决定重新开始图像.使用基本映像,启动了一个容器,其中包含使用现在不相关图像的更新的docker compose文件.润泊坞窗,构成了-f -d - >还有甚至映射这些相同的体积虽然图像不会(和从来没有)的任何卷映射,以及当前泊坞窗,compose.yml文件不映射文件.看起来像docker-compose缓存为项目映射的卷.
在docker-compose中搜索缓存选项后,我遇到了这篇文章:如何让docker-compose始终从新图像重新创建容器? 这似乎解决了缓存图像而不是容器缓存卷的问题
我似乎无法在 Dockerfile 中运行 composer install 但我可以在构建映像并运行容器后在容器中运行。
这是来自 Dockerfile 的命令:
RUN composer require drupal/video_embed_field:1.5
RUN composer install --no-autoloader --no-scripts --no-progress
Run Code Online (Sandbox Code Playgroud)
输出是:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Run Code Online (Sandbox Code Playgroud)
但是在使用 docker-compose 运行容器之后:
...
drupal:
image: docker_image
container_name: container
ports:
- 8081:80
volumes:
- ./container/modules:/var/www/html/web/modules
links:
# Link the DB container:
- db
Run Code Online (Sandbox Code Playgroud)
运行 docker exec composer install 将正确安装软件包:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file …Run Code Online (Sandbox Code Playgroud) 我找到了一些关于如何使用 Drupal 8 打开模式窗口的教程,并不难:
// Add an AJAX command to open a modal dialog with the form as the content.
$response->addCommand(new OpenModalDialogCommand('Load Window', $modal_form, ['width' => '800']));
Run Code Online (Sandbox Code Playgroud)
但现在我如何以编程方式关闭这个窗口?或者更简单地说,我想要模式底部有一个“取消”按钮?