从 EC2 AMI 创建一个 docker 映像/容器 [英] Create a docker image/container from EC2 AMI
问题描述
我对 docker 非常陌生,正在尝试将我的 AWS EC2 AMI 导入到 docker 映像中.该图像是 m2 linux 图像.
I am very new to docker and am trying to import my AWS EC2 AMI into a docker image. The image is a m2 linux image.
我还设置了一个私有 docker hub(artifactory),我打算将图像推送到它并使其可供使用.在不从基础镜像开始更新的情况下,将 AMI 导入 docker 镜像的步骤是什么?
I have also setup a private docker hub(artifactory) to which I intend to push the image and make it available for consumption. What are the steps for importing AMI into docker image without starting from a base image and updating.
指向任何解释的指针也可以.
Pointers to any explanation would work too.
推荐答案
我是这样做的.
- 在源 AMI 上找到描述中的根卷快照 ID
/dev/sda1=snap-eb79b0b1
:15:true:gp2
/dev/sda1=snap-eb79b0b1
:15:true:gp2
使用公共 Ubuntu 14.04 AMI 启动实例
Launch instance with public Ubuntu 14.04 AMI
从快照 snap-eb79b0b1 创建卷(在实例运行的同一区域中).
Create volume from snapshot snap-eb79b0b1 (in the same region that the instance runs).
将卷以 /dev/sdf
将卷挂载到 /mnt
mount/dev/xvdf/mnt
(或)
mount/dev/xvdf1/mnt
- 安装 docker
https://docs.docker.com/engine/installation/ubuntulinux/
- 从挂载的根卷中导入 docker 镜像
tar -c -C/mnt/.|docker 导入 - appcimage-master-1454216413
- 运行
docker run -t -i 6d6614111fcb03d5ca79541b8a23955202dfda74995d968b5ffb5d45c7e68da9/bin/bash
这篇关于从 EC2 AMI 创建一个 docker 映像/容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!