Search code examples
visual-studiodockervisual-studio-2015amazon-ecs

Publishing Docker to AWS from Visual Studio


I want to publish my Docker container to AWS using the Visual Studio interface. I want to specify a custom Docker profile in Visual Studio. I can't seem to connect to AWS that way, though. (Validate Connection always fails.) Is this possible?

I am able to docker build, push to Docker Hub, ssh into my EC2 server (living within ECS), and successfully docker pull, but I'd really like to simplify the process and bypass Docker Hub if possible.

I specified tcp://[my ec2 server]:2376 as the Server URL. I specified the other fields as appropriate. Do I need to specify particular Auth or Run options?


Solution

  • It depends on which AWS region you're using. ECS has a "Repositories" host, sibling to the Clusters and Task Definitions, that's available (for now) only to us-east-1 and us-west-2. When you create a repository, at the top of the page there's an expandable header titled, "Build, Tag, and Push Docker Image". It will give you the instructions for pushing the image.

    The Amazon ECS Developer Guide has a "Repositories" page for more information.

    Tip: trying to login was not immediately clear from the instructions. Running the aws ecr get-login command will respond with the entire login command that you'll need to execute, but it's an extremely long command. You have to be familiar with copy-and-paste in the terminal. (I was not.)

    To copy-and-paste in the terminal,

    1. Click the icon in the top left of the window.
    2. Select Edit > Mark.
    3. Highlight the full width of all the rows.
    4. Select Edit > Copy.
    5. Open notepad, and paste the text.
    6. Remove all line breaks.
    7. Copy everything back to the terminal at the command line (Edit > Paste).
    8. Run the command, and you should now be able to follow the rest of the instructions.