Skip to content

Instantly share code, notes, and snippets.

@a5ync
a5ync / sql-server.sh
Created June 24, 2020 18:45
Docker container for SQL Server 2017
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=N0750much54f3' -p 1433:1433 -d mcr.microsoft.com/mssql/server
@a5ync
a5ync / Dockerfile
Created February 5, 2020 06:57
Szkola chmury docker node
FROM alpine
USER root
WORKDIR /home/app
ADD https://raw.githubusercontent.com/cloudstateu/containers-w3-homework/master/package.json /home/app/package.json
ADD https://raw.githubusercontent.com/cloudstateu/containers-w3-homework/master/index.js /home/app/index.js
RUN apk add --no-cache nodejs npm
@a5ync
a5ync / send-notification.ps1
Created December 31, 2019 01:09
Send notification from Devops to Teams
$teamsNotification = @{
'@type' = 'MessageCard'
'@context'= 'http://schema.org/extensions'
'themeColor' = '0076D7'
'summary' = 'Successful build notification'
'sections' = @(
@{
'activityTitle' = "$(Build.DefinitionName)"
'activitySubtitle' = "image tag $(Build.BuildNumber) deployed to registry"
})
@a5ync
a5ync / log-tcp-activity.ps1
Created December 12, 2019 17:46
Logging netstat from powershell
$ipTracking="10.200.0.109"
while(1)
{
$date=get-date -format "yyyy/MM/dd HH:mm:ss"
$connections =(get-nettcpconnection -remoteaddress $ipTracking `
-ErrorAction SilentlyContinue `
| select-object -Property LocalAddress,LocalPort,RemoteAddress,RemotePort,State, `
@{name='Process';expression={(Get-Process -Id $_.OwningProcess).Name}},CreationTime `
@a5ync
a5ync / config.yml
Created October 28, 2019 23:11
docker-registry configuration
# more /etc/docker/registry/config.yml
version: 0.1
log:
fields:
service: registry
storage:
delete:
enabled: true
cache:
blobdescriptor: inmemory
@a5ync
a5ync / Dockerfile
Created October 22, 2019 23:29
Docker image build for sqlpackage tool (dacpac/bacpac import/export)
FROM alpine:latest
WORKDIR /
RUN wget -q -O sqlpackage.zip https://go.microsoft.com/fwlink/?linkid=873926
RUN mkdir /opt/sqlpackage
RUN unzip -qq sqlpackage.zip -d /opt/sqlpackage
FROM mcr.microsoft.com/dotnet/core/runtime-deps:2.1
RUN apt-get -qq update
# I don't understand why libunwind is required but it is
RUN apt-get -qq install libunwind8
@a5ync
a5ync / docker-list-established-mysql.sh
Created December 20, 2018 00:31
Lists connections (ESTABLISHED) between containers and mysql instance
docker ps -q -f name=utmsp_backend | xargs docker inspect -f '{{.State.Pid}}' | xargs -i nsenter -t {} -n netstat|grep :mysql|grep ESTABLISHED| cut -d ":" -f1|awk '{print $4}'|uniq -c
@a5ync
a5ync / docker-list-connections.sh
Created December 19, 2018 23:13
Lists TCP connections between containers
docker ps -q -f name=utmsp_backend | xargs docker inspect -f '{{.State.Pid}}' | xargs -i nsenter -t {} -n netstat
@a5ync
a5ync / docker-ps-formatted.sh
Created December 14, 2018 00:22
Formatting of docker ps output
docker ps --format "table {{.ID}}\t{{.Names}}\t{{.RunningFor}}\t{{.Status}}"
docker stats --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}"