0

AWS's Import/Exportを使用してAWS AMIを作成するためにDockerイメージをVMDKファイルに変換しようとしました。そのために:AWSインポート/エクスポートタスクのディスク検証に失敗しました

  1. 私は私のDockerFileから.imgファイルを作成するためのthis guideを使用しています。

  2. さて、私は、このコマンドを使用しています:VBoxManage convertfromraw --format VMDK disk.img disk.vmdk.vmdkファイルに私の.imgファイルを変換するには、IMG形式として、AWSサービスによってサポートされていません。私はインポート/エクスポートサービスを実行するときに

はしかし、それは私に、このエラーを与える:

"StatusMessage": "ClientError: Disk validation failed [Unsupported VMDK File Format]" 

は、私は私の変換プロセスに間違っていたものはありますか?

答えて

0

私は同じ問題に関するAWSサポートの人々と接触しています。次のように彼らの応答は次のとおりです。

Unfortunately, importing a Docker image is not supported by VMIE. Since a Docker image is not a fully-virtualized OS, you would not be able to boot into this image even if the import was successful.


There is a much simpler solution by running user-data. As far as the code running inside a container is concerned, there isn't a difference between containers or VM's. The code thinks its running on a regular OS. So instead of creating the docker container with the Dockerfile, you can use a user-data script to do the same things on an instance. For example, with ADD in a Dockerfile, it takes files and writes them to the container. We can pull this file from, say S3, and copy it wherever on the instance is needs to go. It will go in the same place that it lives in the container. The RUN directives in a docker file will map 1-to-1 with a user-data script, since these are simply commands. For the CMD directive, we can simply run that process via user-data. Docker volumes are irrelevant, since we have access to the full storage of the instance, so you can ignore the creation of volumes and simply write wherever any files need to go. In summary, your user-data script will replace the Dockerfile for bootstrapping your instance and running your application. Instead of Dockerfile syntax, you will use Bash syntax. Look below for an example script that mimics your Dockerfile.

#! /bin/bash 
pip install --upgrade --user awscli 
sudo aws s3 cp s3://example-bucket/hello/
sudo chmod +x /hello /hello 

Here is a breakdown of what the script is doing:

  1. Makes sure the aws cli is installed

  2. Pulls the file "hello" from an S3 bucket, and writes it to '/'

  3. Makes sure the file "hello" is executable

  4. Executes hello This is essentially what a Dockerfile does in a container, however instead of pulling from S3, it pulls it from the location of the Dockerfile. After adding your file to S3, you can easily pull it in a user-data script. Running this, you won't even need to create a custom AMI, as the bootstrapping is done on instance after bootup. To select the appropriate OS, you can launch a QuickStart Ubuntu AMI and add this user-data script. Additionally, you can continue testing with Docker without issue, you just need to make sure the file "hello" is in sync between your Docker location and the S3 bucket. You can use the S3 Sync command to accomplish this.

関連する問題