简体   繁体   English

Docker 中的 Docker 和适用于 Windows 容器的 AWS CLI

[英]Docker in Docker and AWS CLI for Windows Containers

I'm trying to migrate .NET legacy application to AWS ECS/Fargate.我正在尝试将 .NET 旧应用程序迁移到 AWS ECS/Fargate。 I'm following this article that explains how to create a custom Windows Docker image with MSBuild tools used in AWS CodePipeline/CodeBuild project.我正在关注这篇文章,该文章解释了如何使用 AWS CodePipeline/CodeBuild 项目中使用的 MSBuild 工具创建自定义 Windows Docker 映像。 I also need to be able to install a Docker deamon and AWS CLIV2 into that custom image so that I could execute docker and AWS CLI commands in buildspec.yaml file in CodeBuild.我还需要能够将 Docker 守护程序和 AWS CLIV2 安装到该自定义映像中,以便我可以在 CodeBuild 的 buildspec.yaml 文件中执行 docker 和 AWS CLI 命令。 So far I've been able to use this code in my custom image Dockerfile which installs Docker in Docker but the Docker service never gets started even though it understands docker --version command.到目前为止,我已经能够在我的自定义映像 Dockerfile 中使用此代码,该映像将 Docker 安装在 Docker 中,但 Docker 服务永远不会启动,即使它理解 docker --version 命令。 I was also trying to modify this PowerShell script to install AWS CLI but also stuck with having little to no progress.我还尝试修改此 PowerShell 脚本以安装 AWS CLI,但也坚持几乎没有进展。

I'd appreciate any help in installing Docker in Docker and AWS CLI.对于在 Docker 和 AWS CLI 中安装 Docker 的任何帮助,我将不胜感激。

When I had to use docker in docker, I instead used the host docker socket by mounting that in the container.当我不得不在 docker 中使用 docker 时,我通过将它安装在容器中来使用主机 docker 套接字。

I had to mount 2 files in linux.我必须在 linux 中挂载 2 个文件。

/usr/bin/docker (executable)
/var/run/docker.sock (service socket)

Update - Above would work for linux, for windows, a double slash is required.更新 - 以上适用于 linux,对于 windows,需要双斜杠。 Below socket would have to be mounted for windows.下面的插座必须安装在窗户上。 I couldn't personally test as I don't have windows.我无法亲自测试,因为我没有窗户。

"\\.\pipe\docker_engine:\\.\pipe\docker_engine"

I found a very good GUI tool explained this我找到了一个很好的 GUI 工具来解释这个在此处输入图像描述

Ref: https://tomgregory.com/running-docker-in-docker-on-windows/参考: https ://tomgregory.com/running-docker-in-docker-on-windows/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM