Docker Commands

# Create a better hyperv machine
docker-machine create -d hyperv --hyperv-cpu-count 2 --hyperv-memory 2048 --hyperv-virtual-switch "ExternalSwitch" default

# Build Docker Image and removing intermediate container
docker build --rm -t myimage .

# Running docker container in the background with multiple ports open
docker run -d -p 8080:8080 -p 5687:5678 puckel/docker-airflow
# Running docker container interactively
docker run -p 127.0.0.1:5678:5678 -it testpython
# Compose docker containers with recreating always
docker-compose -f test.yml up --force-recreate
# Connect to a container's shell in docker
docker exec -it containername /bin/bash

# Override entrypoint of postman docker image with current directory mounted
docker run -it --entrypoint "/bin/sh" -it -v %cd%:/etc/newman postman/newman

# Sudoing under docker ssh
sudo -i

# Clean up all networking devices, with Verbose option, for the case that not everything could be cleaned up
# Can help if having the "userland proxy" problem when executing by not running (stopped) docker service
netcfg -d -v

# Start a local ms-sql instance in docker
docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=MyStr0ng!P6ssw0rd -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2017-latest

And cool links

Advertisements