skip to Main Content

I have a Dockerfile that is literally just (I’ve also tried with only the first line as well):

FROM amazon/aws-cli:latest
CMD [ "sleep", "10000" ]

I build with:

docker build -t image-name .

I run with:

docker run -d --name container-name image-name

When I view the logs of the container this is what is shown:

2024-04-11 12:36:48 
2024-04-11 12:36:48 usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
2024-04-11 12:36:48 To see help text, you can run:
2024-04-11 12:36:48 
2024-04-11 12:36:48   aws help
2024-04-11 12:36:48   aws <command> help
2024-04-11 12:36:48   aws <command> <subcommand> help
2024-04-11 12:36:48 
2024-04-11 12:36:48 aws: error: argument command: Invalid choice, valid choices are:
2024-04-11 12:36:48 
2024-04-11 12:36:48 accessanalyzer                           | account                                 
2024-04-11 12:36:48 acm                                      | acm-pca                                 
2024-04-11 12:36:48 alexaforbusiness                         | amp                                     
2024-04-11 12:36:48 amplify                                  | amplifybackend                          
2024-04-11 12:36:48 amplifyuibuilder                         | apigateway                              
2024-04-11 12:36:48 apigatewaymanagementapi                  | apigatewayv2                            
2024-04-11 12:36:48 appconfig                                | appconfigdata                           
2024-04-11 12:36:48 appfabric                                | appflow                                 
2024-04-11 12:36:48 appintegrations                          | application-autoscaling                 
2024-04-11 12:36:48 application-insights                     | applicationcostprofiler                 
2024-04-11 12:36:48 appmesh                                  | apprunner                               
2024-04-11 12:36:48 appstream                                | appsync                                 
2024-04-11 12:36:48 arc-zonal-shift                          | artifact                                
2024-04-11 12:36:48 athena                                   | auditmanager                            
2024-04-11 12:36:48 autoscaling                              | autoscaling-plans                       
2024-04-11 12:36:48 b2bi                                     | backup                                  
2024-04-11 12:36:48 backup-gateway                           | backupstorage                           
2024-04-11 12:36:48 batch                                    | bcm-data-exports                        
2024-04-11 12:36:48 bedrock                                  | bedrock-agent                           
2024-04-11 12:36:48 bedrock-agent-runtime                    | bedrock-runtime                         
2024-04-11 12:36:48 billingconductor                         | braket                                  
2024-04-11 12:36:48 budgets                                  | ce                                      
2024-04-11 12:36:48 chatbot                                  | chime                                   
2024-04-11 12:36:48 chime-sdk-identity                       | chime-sdk-media-pipelines               
2024-04-11 12:36:48 chime-sdk-meetings                       | chime-sdk-messaging                     
2024-04-11 12:36:48 chime-sdk-voice                          | cleanrooms                              
2024-04-11 12:36:48 cleanroomsml                             | cloud9                                  
2024-04-11 12:36:48 cloudcontrol                             | clouddirectory                          
2024-04-11 12:36:48 cloudformation                           | cloudfront                              
2024-04-11 12:36:48 cloudfront-keyvaluestore                 | cloudhsm                                
2024-04-11 12:36:48 cloudhsmv2                               | cloudsearch                             
2024-04-11 12:36:48 cloudsearchdomain                        | cloudtrail                              
2024-04-11 12:36:48 cloudtrail-data                          | cloudwatch                              
2024-04-11 12:36:48 codeartifact                             | codebuild                               
2024-04-11 12:36:48 codecatalyst                             | codecommit                              
2024-04-11 12:36:48 codeconnections                          | codeguru-reviewer                       
2024-04-11 12:36:48 codeguru-security                        | codeguruprofiler                        
2024-04-11 12:36:48 codepipeline                             | codestar                                
2024-04-11 12:36:48 codestar-connections                     | codestar-notifications                  
2024-04-11 12:36:48 cognito-identity                         | cognito-idp                             
2024-04-11 12:36:48 cognito-sync                             | comprehend                              
2024-04-11 12:36:48 comprehendmedical                        | compute-optimizer                       
2024-04-11 12:36:48 connect                                  | connect-contact-lens                    
2024-04-11 12:36:48 connectcampaigns                         | connectcases                            
2024-04-11 12:36:48 connectparticipant                       | controlcatalog                          
2024-04-11 12:36:48 controltower                             | cost-optimization-hub                   
2024-04-11 12:36:48 cur                                      | customer-profiles                       
2024-04-11 12:36:48 databrew                                 | dataexchange                            
2024-04-11 12:36:48 datapipeline                             | datasync                                
2024-04-11 12:36:48 datazone                                 | dax                                     
2024-04-11 12:36:48 deadline                                 | detective                               
2024-04-11 12:36:48 devicefarm                               | devops-guru                             
2024-04-11 12:36:48 directconnect                            | discovery                               
2024-04-11 12:36:48 dlm                                      | dms                                     
2024-04-11 12:36:48 docdb                                    | docdb-elastic                           
2024-04-11 12:36:48 drs                                      | ds                                      
2024-04-11 12:36:48 dynamodb                                 | dynamodbstreams                         
2024-04-11 12:36:48 ebs                                      | ec2                                     
2024-04-11 12:36:48 ec2-instance-connect                     | ecr                                     
2024-04-11 12:36:48 ecr-public                               | ecs                                     
2024-04-11 12:36:48 efs                                      | eks                                     
2024-04-11 12:36:48 eks-auth                                 | elastic-inference                       
2024-04-11 12:36:48 elasticache                              | elasticbeanstalk                        
2024-04-11 12:36:48 elastictranscoder                        | elb                                     
2024-04-11 12:36:48 elbv2                                    | emr                                     
2024-04-11 12:36:48 emr-containers                           | emr-serverless                          
2024-04-11 12:36:48 entityresolution                         | es                                      
2024-04-11 12:36:48 events                                   | evidently                               
2024-04-11 12:36:48 finspace                                 | finspace-data                           
2024-04-11 12:36:48 firehose                                 | fis                                     
2024-04-11 12:36:48 fms                                      | forecast                                
2024-04-11 12:36:48 forecastquery                            | frauddetector                           
2024-04-11 12:36:48 freetier                                 | fsx                                     
2024-04-11 12:36:48 gamelift                                 | glacier                                 
2024-04-11 12:36:48 globalaccelerator                        | glue                                    
2024-04-11 12:36:48 grafana                                  | greengrass                              
2024-04-11 12:36:48 greengrassv2                             | groundstation                           
2024-04-11 12:36:48 guardduty                                | health                                  
2024-04-11 12:36:48 healthlake                               | honeycode                               
2024-04-11 12:36:48 iam                                      | identitystore                           
2024-04-11 12:36:48 imagebuilder                             | importexport                            
2024-04-11 12:36:48 inspector                                | inspector-scan                          
2024-04-11 12:36:48 inspector2                               | internetmonitor                         
2024-04-11 12:36:48 iot                                      | iot-data                                
2024-04-11 12:36:48 iot-jobs-data                            | iot1click-devices                       
2024-04-11 12:36:48 iot1click-projects                       | iotanalytics                            
2024-04-11 12:36:48 iotdeviceadvisor                         | iotevents                               
2024-04-11 12:36:48 iotevents-data                           | iotfleethub                             
2024-04-11 12:36:48 iotfleetwise                             | iotsecuretunneling                      
2024-04-11 12:36:48 iotsitewise                              | iotthingsgraph                          
2024-04-11 12:36:48 iottwinmaker                             | iotwireless                             
2024-04-11 12:36:48 ivs                                      | ivs-realtime                            
2024-04-11 12:36:48 ivschat                                  | kafka                                   
2024-04-11 12:36:48 kafkaconnect                             | kendra                                  
2024-04-11 12:36:48 kendra-ranking                           | keyspaces                               
2024-04-11 12:36:48 kinesis                                  | kinesis-video-archived-media            
2024-04-11 12:36:48 kinesis-video-media                      | kinesis-video-signaling                 
2024-04-11 12:36:48 kinesis-video-webrtc-storage             | kinesisanalytics                        
2024-04-11 12:36:48 kinesisanalyticsv2                       | kinesisvideo                            
2024-04-11 12:36:48 kms                                      | lakeformation                           
2024-04-11 12:36:48 lambda                                   | launch-wizard                           
2024-04-11 12:36:48 lex-models                               | lex-runtime                             
2024-04-11 12:36:48 lexv2-models                             | lexv2-runtime                           
2024-04-11 12:36:48 license-manager                          | license-manager-linux-subscriptions     
2024-04-11 12:36:48 license-manager-user-subscriptions       | lightsail                               
2024-04-11 12:36:48 location                                 | logs                                    
2024-04-11 12:36:48 lookoutequipment                         | lookoutmetrics                          
2024-04-11 12:36:48 lookoutvision                            | m2                                      
2024-04-11 12:36:48 machinelearning                          | macie2                                  
2024-04-11 12:36:48 managedblockchain                        | managedblockchain-query                 
2024-04-11 12:36:48 marketplace-agreement                    | marketplace-catalog                     
2024-04-11 12:36:48 marketplace-deployment                   | marketplace-entitlement                 
2024-04-11 12:36:48 marketplacecommerceanalytics             | mediaconnect                            
2024-04-11 12:36:48 mediaconvert                             | medialive                               
2024-04-11 12:36:48 mediapackage                             | mediapackage-vod                        
2024-04-11 12:36:48 mediapackagev2                           | mediastore                              
2024-04-11 12:36:48 mediastore-data                          | mediatailor                             
2024-04-11 12:36:48 medical-imaging                          | memorydb                                
2024-04-11 12:36:48 meteringmarketplace                      | mgh                                     
2024-04-11 12:36:48 mgn                                      | migration-hub-refactor-spaces           
2024-04-11 12:36:48 migrationhub-config                      | migrationhuborchestrator                
2024-04-11 12:36:48 migrationhubstrategy                     | mobile                                  
2024-04-11 12:36:48 mq                                       | mturk                                   
2024-04-11 12:36:48 mwaa                                     | neptune                                 
2024-04-11 12:36:48 neptune-graph                            | neptunedata                             
2024-04-11 12:36:48 network-firewall                         | networkmanager                          
2024-04-11 12:36:48 networkmonitor                           | nimble                                  
2024-04-11 12:36:48 oam                                      | omics                                   
2024-04-11 12:36:48 opensearch                               | opensearchserverless                    
2024-04-11 12:36:48 opsworks                                 | opsworkscm                              
2024-04-11 12:36:48 organizations                            | osis                                    
2024-04-11 12:36:48 outposts                                 | panorama                                
2024-04-11 12:36:48 payment-cryptography                     | payment-cryptography-data               
2024-04-11 12:36:48 pca-connector-ad                         | personalize                             
2024-04-11 12:36:48 personalize-events                       | personalize-runtime                     
2024-04-11 12:36:48 pi                                       | pinpoint                                
2024-04-11 12:36:48 pinpoint-email                           | pinpoint-sms-voice                      
2024-04-11 12:36:48 pinpoint-sms-voice-v2                    | pipes                                   
2024-04-11 12:36:48 polly                                    | pricing                                 
2024-04-11 12:36:48 privatenetworks                          | proton                                  
2024-04-11 12:36:48 qbusiness                                | qconnect                                
2024-04-11 12:36:48 qldb                                     | qldb-session                            
2024-04-11 12:36:48 quicksight                               | ram                                     
2024-04-11 12:36:48 rbin                                     | rds                                     
2024-04-11 12:36:48 rds-data                                 | redshift                                
2024-04-11 12:36:48 redshift-data                            | redshift-serverless                     
2024-04-11 12:36:48 rekognition                              | repostspace                             
2024-04-11 12:36:48 resiliencehub                            | resource-explorer-2                     
2024-04-11 12:36:48 resource-groups                          | resourcegroupstaggingapi                
2024-04-11 12:36:48 robomaker                                | rolesanywhere                           
2024-04-11 12:36:48 route53                                  | route53-recovery-cluster                
2024-04-11 12:36:48 route53-recovery-control-config          | route53-recovery-readiness              
2024-04-11 12:36:48 route53domains                           | route53resolver                         
2024-04-11 12:36:48 rum                                      | s3control                               
2024-04-11 12:36:48 s3outposts                               | sagemaker                               
2024-04-11 12:36:48 sagemaker-a2i-runtime                    | sagemaker-edge                          
2024-04-11 12:36:48 sagemaker-featurestore-runtime           | sagemaker-geospatial                    
2024-04-11 12:36:48 sagemaker-metrics                        | sagemaker-runtime                       
2024-04-11 12:36:48 savingsplans                             | scheduler                               
2024-04-11 12:36:48 schemas                                  | sdb                                     
2024-04-11 12:36:48 secretsmanager                           | securityhub                             
2024-04-11 12:36:48 securitylake                             | serverlessrepo                          
2024-04-11 12:36:48 service-quotas                           | servicecatalog                          
2024-04-11 12:36:48 servicecatalog-appregistry               | servicediscovery                        
2024-04-11 12:36:48 ses                                      | sesv2                                   
2024-04-11 12:36:48 shield                                   | signer                                  
2024-04-11 12:36:48 simspaceweaver                           | sms                                     
2024-04-11 12:36:48 snow-device-management                   | snowball                                
2024-04-11 12:36:48 sns                                      | sqs                                     
2024-04-11 12:36:48 ssm                                      | ssm-contacts                            
2024-04-11 12:36:48 ssm-incidents                            | ssm-sap                                 
2024-04-11 12:36:48 sso                                      | sso-admin                               
2024-04-11 12:36:48 sso-oidc                                 | stepfunctions                           
2024-04-11 12:36:48 storagegateway                           | sts                                     
2024-04-11 12:36:48 supplychain                              | support                                 
2024-04-11 12:36:48 support-app                              | swf                                     
2024-04-11 12:36:48 synthetics                               | textract                                
2024-04-11 12:36:48 timestream-influxdb                      | timestream-query                        
2024-04-11 12:36:48 timestream-write                         | tnb                                     
2024-04-11 12:36:48 transcribe                               | transfer                                
2024-04-11 12:36:48 translate                                | trustedadvisor                          
2024-04-11 12:36:48 verifiedpermissions                      | voice-id                                
2024-04-11 12:36:48 vpc-lattice                              | waf                                     
2024-04-11 12:36:48 waf-regional                             | wafv2                                   
2024-04-11 12:36:48 wellarchitected                          | wisdom                                  
2024-04-11 12:36:48 workdocs                                 | worklink                                
2024-04-11 12:36:48 workmail                                 | workmailmessageflow                     
2024-04-11 12:36:48 workspaces                               | workspaces-thin-client                  
2024-04-11 12:36:48 workspaces-web                           | xray                                    
2024-04-11 12:36:48 s3api                                    | s3                                      
2024-04-11 12:36:48 ddb                                      | configure                               
2024-04-11 12:36:48 deploy                                   | configservice                           
2024-04-11 12:36:48 opsworks-cm                              | history                                 
2024-04-11 12:36:48 cli-dev                                  | help                                    
2024-04-11 12:36:48 

…which is normally what appears when you attempt an incorrect aws command like this for example:

aws aaaaaaaaaaaaaaaaaaaaa

Can anyone please help me out? I don’t know if there’s something I’m missing, but I’m really confused as to why this isn’t working. Thank you!

I’ve also tried installing the AWS-CLI in the container per these instructions but had no luck and ran into issues like this when running many commands:

debconf: delaying package configuration, since apt-utils is not installed
dpkg: warning: 'diff' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)

…even though my Path is set properly

2

Answers


  1. Chosen as BEST ANSWER

    Per David Maze's responses, "the base image declares ENTRYPOINT ["aws"] and so it doesn't run normal shell commands", the solution was to change my Dockerfile like this:

    FROM amazon/aws-cli:latest
    ENTRYPOINT [""]
    CMD [ "sleep", "10000" ]
    

  2. This is because the image you grabbed in the docker FROM directive makes use of entrypoint (see https://docs.docker.com/reference/dockerfile/#entrypoint)

    Try doing the run like so instead:

    docker run -d --entrypoint /bin/bash --name container-name image-name
    

    Remove the -d flag to test it out.

    Or modify your docker file like so (i haven’t tested this tho):

    # modified as per @David Maze's comment
    FROM amazon/aws-cli:latest
    ENTRYPOINT ["/bin/bash"]
    CMD [ "sleep", "10000" ]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search