Skip to content

Instantly share code, notes, and snippets.

@aniongithub
Created February 22, 2019 20:59
Show Gist options
  • Save aniongithub/191d5134a74b2adf4a0a59732583c10c to your computer and use it in GitHub Desktop.
Save aniongithub/191d5134a74b2adf4a0a59732583c10c to your computer and use it in GitHub Desktop.
Debugging with Docker and VS Code
#! /bin/bash
# This is a minimal sample, but I will want to pass args and env files to the build command
docker build -t dockerdebug:latest .
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
</Project>
FROM microsoft/dotnet:sdk
COPY . /source
WORKDIR /bin
RUN dotnet build /source/dockerdebug.csproj -o /app
WORKDIR /app
CMD ["dotnet", "dockerdebug.dll"]
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Docker: Launch .NET Core (Preview)",
"type": "docker-coreclr",
"request": "launch",
"preLaunchTask": "build",
"dockerBuild": { }, // What do I put in here?
"dockerRun": { }, // What do I put in here?
}
]
}
using System;
namespace dockerdebug
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World! <Press any key to exit>");
Console.ReadKey(false);
}
}
}
#! /bin/bash
# This is a minimal sample, but I will want to pass more args to this run command
docker run --rm -it dockerdebug:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment