aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.14k stars 4.02k forks source link

How do I exec into container? #6350

Closed LuisEnMarroquin closed 2 years ago

LuisEnMarroquin commented 2 years ago

Confirm by changing [ ] to [x] below:

Issue is about usage on:

Platform/OS/Hardware/Device What are you running the cli on?

Ubuntu 20 LTS

Describe the question

docker run -it amazon/aws-cli sh

Logs/output Get full traceback and error logs by adding --debug to the command.

I want to exec into container with sh or bash

$ docker run -it amazon/aws-cli sh

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument command: Invalid choice, valid choices are:

accessanalyzer                           | acm
acm-pca                                  | alexaforbusiness
amp                                      | amplify
amplifybackend                           | apigateway
apigatewaymanagementapi                  | apigatewayv2
appconfig                                | appflow
appintegrations                          | application-autoscaling
application-insights                     | applicationcostprofiler
appmesh                                  | apprunner
appstream                                | appsync
athena                                   | auditmanager
autoscaling                              | autoscaling-plans
backup                                   | batch
braket                                   | budgets
ce                                       | chime
chime-sdk-identity                       | chime-sdk-messaging
cloud9                                   | clouddirectory
cloudformation                           | cloudfront
cloudhsm                                 | cloudhsmv2
cloudsearch                              | cloudsearchdomain
cloudtrail                               | cloudwatch
codeartifact                             | codebuild
codecommit                               | codeguru-reviewer
codeguruprofiler                         | codepipeline
codestar                                 | codestar-connections
codestar-notifications                   | cognito-identity
cognito-idp                              | cognito-sync
comprehend                               | comprehendmedical
compute-optimizer                        | connect
connect-contact-lens                     | connectparticipant
cur                                      | customer-profiles
databrew                                 | dataexchange
datapipeline                             | datasync
dax                                      | detective
devicefarm                               | devops-guru
directconnect                            | discovery
dlm                                      | dms
docdb                                    | ds
dynamodb                                 | dynamodbstreams
ebs                                      | ec2
ec2-instance-connect                     | ecr
ecr-public                               | ecs
efs                                      | eks
elastic-inference                        | elasticache
elasticbeanstalk                         | elastictranscoder
elb                                      | elbv2
emr                                      | emr-containers
es                                       | events
finspace                                 | finspace-data
firehose                                 | fis
fms                                      | forecast
forecastquery                            | frauddetector
fsx                                      | gamelift
glacier                                  | globalaccelerator
glue                                     | greengrass
greengrassv2                             | groundstation
guardduty                                | health
healthlake                               | honeycode
iam                                      | identitystore
imagebuilder                             | importexport
inspector                                | iot
iot-data                                 | iot-jobs-data
iot1click-devices                        | iot1click-projects
iotanalytics                             | iotdeviceadvisor
iotevents                                | iotevents-data
iotfleethub                              | iotsecuretunneling
iotsitewise                              | iotthingsgraph
iotwireless                              | ivs
kafka                                    | kendra
kinesis                                  | kinesis-video-archived-media
kinesis-video-media                      | kinesis-video-signaling
kinesisanalytics                         | kinesisanalyticsv2
kinesisvideo                             | kms
lakeformation                            | lambda
lex-models                               | lex-runtime
lexv2-models                             | lexv2-runtime
license-manager                          | lightsail
location                                 | logs
lookoutequipment                         | lookoutmetrics
lookoutvision                            | machinelearning
macie                                    | macie2
managedblockchain                        | marketplace-catalog
marketplace-entitlement                  | marketplacecommerceanalytics
mediaconnect                             | mediaconvert
medialive                                | mediapackage
mediapackage-vod                         | mediastore
mediastore-data                          | mediatailor
memorydb                                 | meteringmarketplace
mgh                                      | mgn
migrationhub-config                      | mobile
mq                                       | mturk
mwaa                                     | neptune
network-firewall                         | networkmanager
nimble                                   | opsworks
opsworkscm                               | organizations
outposts                                 | personalize
personalize-events                       | personalize-runtime
pi                                       | pinpoint
pinpoint-email                           | pinpoint-sms-voice
polly                                    | pricing
proton                                   | qldb
qldb-session                             | quicksight
ram                                      | rds
rds-data                                 | redshift
redshift-data                            | rekognition
resource-groups                          | resourcegroupstaggingapi
robomaker                                | route53
route53-recovery-cluster                 | route53-recovery-control-config
route53-recovery-readiness               | route53domains
route53resolver                          | s3control
s3outposts                               | sagemaker
sagemaker-a2i-runtime                    | sagemaker-edge
sagemaker-featurestore-runtime           | sagemaker-runtime
savingsplans                             | schemas
sdb                                      | secretsmanager
securityhub                              | serverlessrepo
service-quotas                           | servicecatalog
servicecatalog-appregistry               | servicediscovery
ses                                      | sesv2
shield                                   | signer
sms                                      | snow-device-management
snowball                                 | sns
sqs                                      | ssm
ssm-contacts                             | ssm-incidents
sso                                      | sso-admin
sso-oidc                                 | stepfunctions
storagegateway                           | sts
support                                  | swf
synthetics                               | textract
timestream-query                         | timestream-write
transcribe                               | transfer
translate                                | waf
waf-regional                             | wafv2
wellarchitected                          | workdocs
worklink                                 | workmail
workmailmessageflow                      | workspaces
xray                                     | s3api
s3                                       | ddb
configure                                | deploy
configservice                            | opsworks-cm
history                                  | cli-dev
help
kdaily commented 2 years ago

Hi @LuisEnMarroquin,

The default entrypoint for the AWS CLI Docker container image is set to the aws executable. This provides the most natural way to use the container image as a drop-in replacement for running the aws command on the command line. If you want to enter into the running container, you can provide your own entrypoint, like this:

docker run --entrypoint /bin/bash --rm -it amazon/aws-cli

You can also create your own image based off of this one and provide your own ENTRYPOINT. Be aware that the environment provided inside is very minimal.

You can read more about Docker entrypoints here:

Let us know if you have any further issues!

github-actions[bot] commented 2 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.