app2container containerize command
When you run this command, it creates a Docker container image for your application. The
is based on the parameters in the analysis.json
file that is generated by
the analyze command, along with any
customizations you have made. By default, the image is pre-validated to ensure that the
application container runs and returns a successful response, as expected.
See Configuring application containers
for more information about configuring the analysis.json
file.
If the command fails, an error message is displayed in the console, followed by
additional messaging to help you troubleshoot.
When you ran the init command, if you chose to automatically
upload logs to App2Container support if an error occurs, App2Container notifies you of the
success of the automatic upload of your application support bundle.
Otherwise, App2Container messaging directs you to upload application artifacts by
running the upload-support-bundle command for additional support.
Syntax
app2container containerize {--application-id id
| --input-archive extraction-file
} [--no-validate] [--help]
Parameters and options
Parameters
- --application-id
id
-
The application ID (required). After you run the inventory command, you can find the application ID in the inventory.json
file in one of the following locations:
- --input-archive
extraction-file
-
The file path or Amazon S3 key (for example,
s3://bucket
/archive-key
)
for the application archive. If you specify an application archive, the
command downloads and opens the archive, and then builds the container
image.
- --profile
admin-profile
-
Use this option to specify a named profile to run this
command. For more information about named profiles in AWS, see
Named profiles
in the AWS Command Line Interface User Guide
Options
- --build-only
-
Builds container images based on the existing Dockerfile
and artifacts.
- --force
-
Bypasses the disk space prerequisite check.
- --no-validate
-
Bypasses pre-validation of the generated container image.
- --help
-
Displays the command help.
Output
This command generates a Dockerfile
, a container image, and a deployment.json
file that you can use with the generate app-deployment command.
It also generates a Dockerfile.update
file that you can use to
make updates to your containerized application. The generate pipeline
command adds this Dockerfile to your CodeCommit repository and deploys updates to your CodePipeline
infrastructure.
See deployment.json file for more information about
configuration, and for an example of what the deployment.json
file looks like.
Examples
Choose the operating system platform tab for the application server or worker machine where
you run the command.
- Linux
-
The following example shows the containerize command with the --application-id
parameter and no additional options.
$
sudo app2container containerize --application-id java-tomcat-9e8e4799
√ AWS pre-requisite check succeeded
√ Docker pre-requisite check succeeded
√ Extracted container artifacts for application
√ Entry file generated
√ Dockerfile generated under /root/app2container/java-tomcat-9e8e4799/Artifacts
√ Generated dockerfile.update under /root/app2container/java-tomcat-9e8e4799/Artifacts
√ Generated deployment file at /root/app2container/java-tomcat-9e8e4799/deployment.json
√ Deployment artifacts generated.
√ Pre-validation succeeded.
Containerization successful. Generated docker image java-tomcat-9e8e4799
You're all set to test and deploy your container image.
Next Steps:
1. View the container image with \"docker images\" and test the application.
2. When you're ready to deploy to AWS, please edit the deployment file as needed at /root/app2container/java-tomcat-9e8e4799/deployment.json.
3. Generate deployment artifacts using app2container generate app-deployment --application-id java-tomcat-9e8e4799
Please use "docker images" to view the generated container image.
The following example shows the containerize command with the
--input-archive
option.
$
sudo app2container containerize --input-archive /var/aws/java-tomcat-9e8e4799/java-tomcat-9e8e4799-extraction.tar
- Windows
-
The following example shows the containerize command with the --application-id
parameter and no additional options.
PS>
app2container containerize --application-id iis-smarts-51d2dbf8
√ AWS pre-requisite check succeeded
√ Docker pre-requisite check succeeded
√ Extracted container artifacts for application
√ Entry file generated
√ Dockerfile generated under C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\Artifacts
√ Generated dockerfile.update under C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\Artifacts
√ Generated deployment file at C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\deployment.json
Containerization successful. Generated docker image iis-smarts-51d2dbf8
You're all set to test and deploy your container image.
Next Steps:
1. View the container image with \"docker images\" and test the application.
2. When you're ready to deploy to AWS, please edit the deployment file as needed at C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\deployment.json.
3. Generate deployment artifacts using app2container generate app-deployment --application-id iis-smarts-51d2dbf8
Please use "docker images" to view the generated container image.
The following example shows the containerize command with the
--input-archive
option.
PS>
app2container containerize --input-archive archive C:\Users\Administrator\Downloads\iis-smarts-51d2dbf8.zip
√ AWS pre-requisite check succeeded
√ Docker pre-requisite check succeeded
√ Dockerfile generated under C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\Artifacts
√ Generated dockerfile.update under C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\Artifacts
√ Generated deployment file at C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\deployment.json
Containerization successful. Generated docker image iis-smarts-51d2dbf8
You're all set to test and deploy your container image.
Next Steps:
1. View the container image with \"docker images\" and test the application.
2. When you're ready to deploy to AWS, please edit the deployment file as needed at C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\deployment.json.
3. Generate deployment artifacts using app2container generate app-deployment --application-id iis-smarts-51d2dbf8
To have gMSA related artifacts generated with CloudFormation, please edit gMSAParams inside deployment file.
Otherwise look at C:\Users\Administrator\AppData\Local\app2container\iis-smarts-51d2dbf8\Artifacts\WindowsAuthSetupInstructions.md for setup instructions on Windows Authentication
Please use "docker images" to view the generated container image.