Docker Commands
docker image build –tag webinar-app:v2 –file .\docker\web\Dockerfile .
linux server aws
sudo yum install -y docker
sudo service docker restart
docker-machine ip default
docker rmi $(docker images -q)
docker pull debian:jessie
dotnet new webapi -n DockerAPI dotnet new mvc -n Dockermvcapp
code -r DockerAPI
dotnet run
docker –version
docker build -t lalitnailwal/unixdockerapi .
docker images
docker run -p 8090:80 lalitnailwal/unixdockerapi docker run -it -rm -p 8080:80 unixdockerapi:v1
http://locahost:8090/api/values
docker ps
docker stop <imageid or image name>
docker push lalitnailwal/unixdockerapi
onLinux machine
sudo docker –version
sudo docker run -p 8090:80 lalitnailwal/unixdockerapi sudo docker run -p 8090:80 lalitnailwal/dockermvclightapp:v1
git branch: ‘BSEEBIX_QA’, changelog: false, credentialsId: ’30a407e9-437d-42ca-a6cc-5a489bdad0b3′, poll: false, url: ‘https://gitlab.ebix.com/BSEEBIX/GIBL.git’
===================================================================
# escape=`
FROM sixeyed/msbuild:netfx-4.5.2-webdeploy AS build-agent
WORKDIR C:\src\SignUp.Web
COPY src\SignUp.Web\packages.config .
RUN nuget restore packages.config -PackagesDirectory ..\packages
COPY src\ C:\src
RUN msbuild SignUp.Web.csproj /p:OutputPath=C:\out /p:DeployOnBuild=true `
/p:VSToolsPath=C:\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath
FROM microsoft/aspnet:windowsservercore
SHELL [“powershell”]
WORKDIR C:\web-app
RUN Remove-Website -Name ‘Default Web Site’; `
New-Website -Name ‘web-app’ -Port 80 -PhysicalPath ‘C:\web-app’
COPY –from=build-agent C:\out\_PublishedWebsites\SignUp.Web C:\web-app
=======================================================================
images pulled atbelow paths
c:\programdata\docker\windowsfilter
var\lib\docker/<storage-driver>
docker version
docker info
docker pull alpine
docker pull ubuntu
docker pull ubuntu 14.04
docker run hello-world
docker run redis
docker run alpine
docker run dockerapi
docker run busybox
docker run busybox echo Hello Harry (running a docker container overwriting its default startup command)
docker run busybox ping codewithharry.command
docker run busybox ls
dovker stop <container>
docker rm <container>
docker rm -f <container>
docker ps (show all active containers)
docker ps –all (will show all container which are active and which are exited)
dovker images
docker image ls –digest
docker image push <image name>
docker image pull <imagename>
docker history psweb
docker image inspect psweb
docker rmi <image name> (To remove an image form host)
docker stop <containerid>
docker run (docker create + docker start)
docker create hello-world
docker start -a <hash found in last command above> (-a means attach to the container and provides its output on my client)
docker logs <containerid> (to know what is happening inside container)
docker kill <containerid> (force stop, when process is not respoding)
docker exec -i -t <containerid> sh (sh means start terminal inside docker process, -i attach client to stdin of terminal, -t for beautification of output of the commands run inside container)
docker build . (create an image file looking at Dockerfile in current directory)
docker build -t harry/redis:latest .
docker run harry/redis
docker run -it alpine sh
docker commit -c ‘CMD “redis-server”‘ <containerid>
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker ps -aq)
docker run -d –name web -p 80:8080 nigelpuulton/pluralsight-docker-ci
docker run -it –name temp ubuntu:latest /bin/bash (open it standared instream and interactive to teminal)
sample docker file
# step1 specify the base image
FROM alpine
# Download and install dependencies
RUN apk add –update redis
# setup the startup command
CMD [“redis-server”]
when we say docker we talk about entire ecosystem that includes docker client(cli), docker server(daemon), docker machine, docker hub, docker compose etc.
docker client can run in windows, mac, linux but docker daemon is in linux only as resouce shareing code has been written in linux only
image is just a file contain raw infomation about dependencies and configuration but container is isolated set of hardware resources created from image where its been provided with required resources like cpu, ram, hdd
docker client communicate with docker server for execution of commands
when we talk about a container it only contain that much software which are actually needed so that is saves resources and it run in lighweight fashion
image is also called as a file system snapshot along with a startup command. when docker run busybox is executed it actually run the startup command and spins
a container for that
Dockerfile (plain text file) contains all the info for running your software in a base container
creating a custom image = choose base image + run command for software + specify the base command to be run at startup