20

I'm trying to create a Docker context that will automatically integrate with AWS's ECS. I'm following this tutorial

The author just does: docker context create ecs myecs and gets a "pick an integration" prompt, whereas I get an error saying it needs exactly 1 argument.

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

Usage:  docker context create [OPTIONS] CONTEXT

Create a context
Deepak Gupta
  • 387
  • 2
  • 17

5 Answers5

19

You need to install the Docker Compose CLI preview

The below curl is from here: Docker docs

  1. curl -L https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh | sh
    
  2. sudo docker context create ecs myecs
    

It didn't work without sudo for me for some reason.

After the script finished I had some weird errors: cp: cannot stat '/tmp/tmp.d4QjhW8T6k/docker-compose': No such file or directory and docker context create ecs myecs didn't work at first, but once I tried with sudo it worked fine.

EDIT: . ~/.zshrc (or just close your terminal and open a new one) made it possible for me to run docker context create ecs myecs without sudo.

  • 2
    It works only with sudo because the installation script downloads the docker executable in `/usr/local/bin` while you problably already have another docker executable in `/usr/bin`. If you try with `/usr/local/bin/docker context ...` it will work. – Mir Aug 12 '21 at 08:19
  • 1
    Changes might not take effect unless you open a new terminal – MegaSpaceHamlet Dec 07 '22 at 18:52
3

Author of the blog/tutorial here. It looks like you don't have the pre-requsite installed. In the blog I call out the pre-req in pieces like this.

....In July, Docker released a beta for Docker Desktop that embedded these functionalities and, on September 15th, Docker released an updated experience in their Docker Desktop stable channel....

and then

...For now the only thing you need is Docker Desktop and an AWS account. For this test , I am using Docker Desktop (stable) version 2.5.0.1....

and finally

The core of this integration is built around a new tool dubbed Compose CLI (this is not to be confused with the original docker-compose CLI). This new CLI surfaces to the user as new functionalities in the docker command. While in Docker Desktop all this plumbing is completely hidden and available out of the box, if you are using a Linux machine you can set it up using either a script or a manual install. This new CLI is, essentially, a new version of the docker binary.

Eager to understand more how we could make it more clear / front and center that there were stuff to install and/or minimum software versions you had to use.

Thanks for trying it out!

mreferre
  • 5,464
  • 3
  • 22
  • 29
  • Maybe you could give some commands to run with the expected output thus I'd would be easier to know if we meet the pre-requisite – Bruno Apr 20 '22 at 10:10
  • Any idea how to use this feature without Docker Desktop? I've made my own question for that specifically: https://stackoverflow.com/questions/74903496/create-ecs-context-with-docker-without-docker-desktop – Josh Elias Dec 23 '22 at 20:10
2

If you're on Linux and you're running the docker context create ecs myecscontext command from the docs then try enabling experimental features in docker:

Edit /etc/docker/daemon.json

Set contents to

{
    "experimental": true
}

Restart docker service sudo systemctl restart docker

Exit your terminal and open a new one so that the changes take effect.

forgetso
  • 2,194
  • 14
  • 33
0

I had same issue but after installing Docker Desktop version problem resolved.

Server side version doesn't have such kind of functionality.

0

In my case, I had to run brew uninstall docker -- for some reason it was pointing to a different binary than the one that I had with Docker Desktop.

Roy
  • 3,574
  • 2
  • 29
  • 39