atlas deployments Error: (Unauthorized) Command createSearchIndexes requires authentication

I’m trying the run MongoDB Atlas locally using docker. I’m following the tutorial on mongodb.com

So, I have docker with MongoAtlas up and running. The first step was to insert the test data. That one completed successfully. Now I need to create the search index:

 $> atlas deployments search indexes create
  ? Search Index Name searchIndex
  ? Database sample_mflix
  ? Collection movies
  Error: (Unauthorized) Command createSearchIndexes requires authentication

I run this command inside the docker container. If I run it from my Mac, it just hangs and nothing happens. So I have 2 questions at this point:

  1. Is there a way to run this command from outside the docker container (Mac cli)?
  2. How can I provide authentication options. I tried atlas auth login, but that just seems to authenticate with my mongodb.com account, and results in the same error

I found it. With the help of

$> atlas deployments search indexes create --help

I found out that you can specify a –username and –password:

$> atlas deployments search indexes create --password psswd --username admin

This only works if executed inside the container. If someone knows how to specify an connection string (for example: mongodb://admin:psswd@localhost:27017/?directConnection=true) so I can run this command from outside the container, I would love to hear how this is done?