Getting Started With Docker On Mac

Install and run Docker Desktop on Mac. Double-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder. Double-click in the Applications folder to start Docker. In the example below, the Applications folder is in “grid” view mode. The Docker menu displays the Docker Subscription Service Agreement window. It includes a change to the terms of use for Docker. Getting started with the Docker for Mac beta. The new Docker for Mac beta software has an easy-to-use installer that dropped certain dependencies—VirtualBox, most notably—in favor of a lightweight Linux virtual machine using a macOS-native virtualization solution. The new Docker beta has a toolbar helper for Mac. How to get Docker running on your Raspberry Pi using Mac OS X. This guide shows you how to get Docker running on your Raspberry Pi using a Mac OS X workstation. If you have not read the getting started guide about Docker on the Raspberry Pi yet you might wanna check it out first: Getting started with Docker on your ARM Device We tried to make this guide as concise as possible.

-->Getting Started With Docker On Mac

With Visual Studio for Mac, you can easily build, debug, and run containerized ASP.NET Core apps and publish them to Azure.


Installation and Setup


For Docker installation, review and follow the information at Install Docker Desktop for Mac.


Creating an ASP.NET Core Web Application and Adding Docker Support

  1. Create a new solution by going to File > New Solution.
  2. Under .NET Core > App choose the Web Application template:
  3. Select the target framework. In this example we will use .NET Core 2.2:
  4. Enter the project details, such as name (DockerDemo in this example). The created project contains all the basics you need to build and run an ASP.NET Core web site.
  5. In the Solution Window, right click the DockerDemo project and select Add > Add Docker Support:

Visual Studio for Mac will automatically add a new project to your solution called docker-compose and add a Dockerfile to your existing project.

Dockerfile Overview

A Dockerfile is the recipe for creating a final Docker image. Refer to Dockerfile reference for an understanding of the commands within it.

The preceding Dockerfile is based on the microsoft/aspnetcore image, and includes instructions for modifying the base image by building your project and adding it to the container.


The default Dockerfile created by Visual Studio for Mac exposes Port 80 for HTTP traffic. To enable HTTPS traffic, add Expose 443 to the Dockerfile.

Getting Started With Docker On Mac


Select the docker-compose project as the Startup Project and start debugging (Run > Start Debugging). This will build, deploy and launch the ASP.NET project in a container.


On the first run after installing Docker Desktop, you may receive the following error when trying to debug: Cannot start service dockerdemo: Mounts denied

Add /usr/local/share/dotnet/sdk/NuGetFallbackFolder to the File Sharing tab in Docker Desktop:

Docker Version History

When the build is completed, the application will be launched in Safari:

Note that the container will be listening on a port, http://localhost:32768 for example, and this port may vary.

To see the list of running containers, use the docker ps command in Terminal.

Getting Started With Docker On Mac Free

Note the port relay in the screenshot below (under PORTS). This shows that the container is listening on the port we saw in Safari above and relaying requests to the internal webserver on port 80 (as defined in the Dockerfile). From the application's perspective, it is listening on port 80: