Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Morton kyle-morton

View GitHub Profile
View docker-compose.md

Docker Compose

Features

  • manages the whole app lifecycle -- start, stop, and rebuilding services -- view status of running services -- stream the log output of running services -- run a one-off command on a service
View docker-container-linking.md

Container Linking

  • this is very useful if you have an app image that needs to communicate w/ 1 or more other containers (things like a web server, database(s), other app servers, etc)

Linking containers by name (legacy linking)

Steps

  1. Run container w/ a name using cmd line switch
@kyle-morton
kyle-morton / dev.Dockerfile
Created Aug 15, 2020
Development dockerfile
View dev.Dockerfile
FROM mcr.microsoft.com/dotnet/core/sdk
LABEL key="Kyle Morton"
ENV ASPNETCORE_URLS=http://*:5000
ENV DOTNET_USE_POLLING_FILE_WATCHER=1
ENV ASPNETCORE_ENVIRONMENT=development
WORKDIR /app
View vscode-autogenerated.dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1909 AS base
WORKDIR /app
EXPOSE 5000
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1909 AS build
WORKDIR /src
COPY ["docker-mvc.csproj", "./"]
RUN dotnet restore "./docker-mvc.csproj"
COPY . .
WORKDIR "/src/."
View dockerfile-notes.md

Dockerfile

Dockerfiles represent a way to create an image w/ a layered file system using 1 or more existing images along w/ steps to build/copy files and dependencies.

Creating a customer ASP.NET Core Dockerfile

Easy way to autogenerate a production ready .dockerfile in VS Code -

  1. open project folder in vscode
  2. install both the docker & C# (omnisharp) extensions
View gist:0e9624834946c1a1dc4c343a471ef634

Key Docker Commands

IMAGES

docker pull [image-name]

  • pull image onto machine

docker images

  • list images on your machine
View Download YT Audio using youtube-dl
var strCmdText = "/C youtube-dl -i --extract-audio --audio-format mp3 --audio-quality 0 {YOUTUBE_URL};
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
@kyle-morton
kyle-morton / swift-optionals.swift
Created Jun 25, 2019
small playground used to learn about swift optionals and syntax
View swift-optionals.swift
import UIKit
var str = "Hello, playground"
func sayTitle(title: String) {
print("Title: \(title)")
}
class Movie {
var title: String?
You can’t perform that action at this time.