Quick peek into any file | Creating a file in terminal
| Clean up commands$ docker stop $(docker container ls -aq) $ docker rm $(docker container ls -aq) $ docker rmi $(docker images -q) |
|
Current directory (application artifacts) | Current file path | Listing images and containers |
Pulling an image | Building an image$ docker image build -t . |
| Inspecting images and containers |
Tagging an Image | Pushing an Image to Registry | Removing images and containers |
Running interactive container$ docker container run -it /bin/sh |
| Running a command in the container | Exiting the Container |
Running interactive container with assigned a name$ docker container run -it –name /bin/sh |
| Running a container in detached mode$ docker container run -d –name /bin/sh |
| Getting inside detached running container$ docker container exec -it /bin/sh |
|
Attaching to detached running Container$ docker container attach |
| Running detached container for web applications$ docker container run -d –name –publish 80:8080 |
| Checking via web browser |
Creating a file in the container | Stopping a container | Starting a stopped container |
Removing the containers | Building an Image$ docker image build -f -t . |
| Listing the Images |
Create and start the containers | Listing the Containers | Scaling the containers$ docker-compose up -d –scale = |
|
Stop the Containers | Step 1: Create a directory in the container host filesystem | Step 2: Create a file in the new directory |
Step 3: Run the container with bind moun$ docker container run -it –name -v $HOME/:/ /bin/sh |
| Step 4: List the files in the bind mounted directory | Step 5: Create a file in the bind mounted directory |
Step 6: List the files in the container host filesystem | Step 7: Running a new container with bind mount$ docker container run -it –name -v $HOME/:/ /bin/sh |
| Step 1: Create a new Volume |
Step 2: Listing the volumes | Step 3: Run a container and mount the volume$ docker container run -it –name –mount type=volume,source=,target=/ /bin/sh |
| Step 4: Create a file in the directory |
Step 5: Inspecting the Volume | Step 6: List the mountpoint | Step 7: Run a new container and mount the same volume$ docker container run -it –name –mount type=volume,source=,target= /bin/sh |
|
Step 8: List the files in the volume mounted directory | Step 9: Removing the Volume | |