Docker CLI Handy commands
Display help options
docker
docker container <command>--help
To Get some Docker installation-related details
docker --version
docker -v
docker version
docker info
where docker
List the Docker images currently available into the machine (OS)
docker images
docker image ls
List the running container
docker container ls --all
docker container ls -a
To View Running process in docker
docker ps
docker ps -all [To view even more details about your Docker installation]
docker ps -a
docker ps -a --no--trunc
Running containers in docker
docker run <imagename> [e.g. docker run microsoft/dotnet:nanoserver or
docker run hello-world]
docker run <imagename> [open interactive container e.g. docker run -it microsoft/dotnet:nanoserver]
Build, Running & push docker images (create a docker file say 'dockerfile' and run the below command from the same location)
[dockerfile example]
docker build -t deepakshaw/stafftodoapi .
After a successful build the below commands
docker run -rm -it -p 8080:80 deepakshaw/stafftodoapi
Pushing the docker image to docker-hub registry (its publish registry to share)
docker push deepakshaw/stafftodoapi
Quit from docker containers in docker
docker CRLT P+Q
docker exit
Remove one or more containers (e.g. <CONTAINER ID> cd20b396a061)
docker container rm <CONTAINER ID> <CONTAINER ID>
Remove one or more Images (e.g. <CONTAINER ID> cd20b396a061)
docker image rm 75835a67d134 2a4cca5ac898
docker
docker container <command>--help
To Get some Docker installation-related details
docker --version
docker -v
docker version
docker info
where docker
List the Docker images currently available into the machine (OS)
docker images
docker image ls
List the running container
docker container ls --all
docker container ls -a
To View Running process in docker
docker ps
docker ps -all [To view even more details about your Docker installation]
docker ps -a
docker ps -a --no--trunc
Running containers in docker
docker run <imagename> [e.g. docker run microsoft/dotnet:nanoserver or
docker run hello-world]
docker run <imagename> [open interactive container e.g. docker run -it microsoft/dotnet:nanoserver]
Build, Running & push docker images (create a docker file say 'dockerfile' and run the below command from the same location)
[dockerfile example]
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env WORKDIR /app COPY bin/Debug/netcoreapp2.2/publish . ENTRYPOINT ["dotnet", "StaffToDo.API.dll"]
docker build -t deepakshaw/stafftodoapi .
After a successful build the below commands
docker run -rm -it -p 8080:80 deepakshaw/stafftodoapi
Pushing the docker image to docker-hub registry (its publish registry to share)
docker push deepakshaw/stafftodoapi
Quit from docker containers in docker
docker CRLT P+Q
docker exit
Remove one or more containers (e.g. <CONTAINER ID> cd20b396a061)
docker container rm <CONTAINER ID> <CONTAINER ID>
Remove one or more Images (e.g. <CONTAINER ID> cd20b396a061)
docker image rm 75835a67d134 2a4cca5ac898
| Traditional Software |
Docker Equivalent |
Docker Command |
|---|---|---|
| Find software | DockerHub | |
| Download s/w (zip or msi) | Pull an image | docker pull |
| Install software | Create a container from an image | docker create |
| Start software | Run the container | docker start |
| Stop software | Stop the container | docker stop |
| Uninstall software | Remove the container | dockerrm |
| Not Possible | Do all of this with one command! | dockerrun |

Comments
Post a Comment