Creating aws context for Deploying Docker containers on ECS

0

hi Guys,

I am trying to run the follwowing command: docker context create ecs myeccontext but get the below error:

"docker context create" requires exactly 1 argument. See 'docker context create --help'.

Usage: docker context create [OPTIONS] CONTEXT

Create a context

I’m running docker on MacOS Monterey 12.5.1 docker --version Docker version 20.10.17, build 100c70180f

Thank you.

2 Answers
0

Greetings,

Looking at the help for this command in docker the example: docker context create my-context --description "some description" --docker "host=tcp://myserver:2376,ca=~/ca-file,cert=~/cert-file,key=~/key-file

I was able to create a context using

docker context create myecs
myecs
Successfully created context "myecs"

And for ecs

 docker context create ecs myecscontext
? Create a Docker context using: An existing AWS profile
? Select AWS Profile myuser-admin
Successfully created ecs context "myecscontext"

I have Docker Desktop 4.5.0 (74594) and docker client version 20.10.12 on Mac M1 arm64. I also have docker compose docker-compose version 1.29.2, build 5becea4c installed.

Check out this blog Deploy applications on Amazon ECS using Docker Compose as it has a walk through on contexts.

AWS
answered 2 years ago
  • hi, thank you for you answer but I am still not able to create ecs context.

    I am able to create myecs as you did above.

    I too am running Mac M1.

    Here is my aws configure list: Name Value Type Location ---- ----- ---- -------- profile <not set> None None access_key ****************3QVK shared-credentials-file secret_key ****************dwxQ shared-credentials-file region us-east-1 config-file ~/.aws/config

     ~/ docker context create ecs ecs Successfully created context "ecs"  ~/ docker context create ecs myecscontext "docker context create" requires exactly 1 argument. See 'docker context create --help'.

    Usage: docker context create [OPTIONS] CONTEXT

    Create a context

    I don't understand, what am I missing?

  • Do you have docker compose installed?
    If not please install it https://github.com/docker/compose-cli/blob/main/INSTALL.md

  • hi, it says if you have docker desktop installed, it comes with the following:

    Docker Desktop includes Docker Engine, Docker CLI client, Docker Build/BuildKit, Docker Compose, Docker Content Trust, Kubernetes, Docker Scan, and Credential Helper.

    Here is the docker full info:

     /usr/local/bin/ which docker /opt/homebrew/bin/docker  /usr/local/bin/ docker version Client: Docker Engine - Community Version: 20.10.17 API version: 1.41 Go version: go1.18.3 Git commit: 100c70180f Built: Mon Jun 6 21:36:39 2022 OS/Arch: darwin/arm64 Context: default Experimental: true

    Server: Docker Desktop 4.12.0 (85629) Engine: Version: 20.10.17 API version: 1.41 (minimum version 1.12) Go version: go1.17.11 Git commit: a89b842 Built: Mon Jun 6 23:01:01 2022 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.8 GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0

  • I noticed in your provided examples you do not get the prompt for choosing an AWS profile or credential when creating the ECS context. can you verify the AWS CLI is installed? Looking at the official docs here https://docs.docker.com/cloud/ecs-integration/ and on this section https://docs.docker.com/cloud/ecs-integration/#create-aws-context it should be prompting you for credentials.

0

hi, you are correct, I do not get the prompt.

my aws cli version: aws-cli/2.7.35 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off

Do you think I am missing anything on the AWS side? I tried following this instruction: https://docs.docker.com/cloud/ecs-integration/#requirements

(sorry, my userid changed when I had to login again)

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions