GithubHelp home page GithubHelp logo

talha110 / piaic-docker-cnc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uqutub/piaic-docker-cnc

0.0 2.0 0.0 73 KB

PIAIC Docker Class Code

Dockerfile 36.23% HTML 7.79% PHP 1.27% Python 8.62% JavaScript 10.85% Shell 35.24%

piaic-docker-cnc's Introduction

Docker

Build Image

docker build -t <image-name>:<tag> .

$ docker build -t myapp:1 .

Run Container

docker run --name <container-name> -p <host-port>:<container-port> <image-name>:<tag>

$ docker run --name cont-name -p 8080:80 myapp:1

For Test

$ curl http://localhost:8080

Cleanup

Running container can be stopped by

$ docker stop cont-name

and removed by

$ docker rm cont-name

With the image it is even simpler. In order to remove it run

$ docker rmi myapp:1

(before removing any Docker image you always must stop all containers that uses the image).


Cheat Sheet

Command Description
docker pull user/<image-name>:<tag> Pulls the image from the docker hub
build -t <image-name>:<tag> . Builds the image from the Dockerfile with the mentioned name and tag
docker image ls Shows the list of the images present on your system. short-hand 'docker images'
docker container ls Displays the only running containers. short-hand 'docker ps'
docker container ls -a Displays all the containers present on your system. short-hand 'docker ps -a'
docker inspect <image name>:<tag> Shows the detailed information about the image in JSON format.
docker history <image name>:<tag> Used to inspect the layers of the image.
docker tag <source-image>:<tag> <new-image-name>:<tag> Create a tag of the new image that refers to source image.
docker push user/<image-name>:<tag> Push an image to a registry
docker image rm <image name>:<tag> Remove the image. short-hand 'docker rmi <image name>:<tag>'
docker run --name <container_name> -p <host:port> -d <image_name> Create the container with the specified name and assign the specified port from the image.
docker run --name <container-name> -it -p <host-port> <image-name>:<tag> sh To run a container from an image in an interactive mode. Press Ctrl + pq it will detach terminal and leave container running in background.
docker exec -it <container_name> sh To go in the running container shell. Write exit to detach the terminal
docker stop container_name It will stop the running container.
docker start container_name Start the stopped container
docker rm container_name Remove the container.
docker logs container_name fetch the logs of the container
docker volume create my-vol Create your Volume for Persistent Data
docker volumes ls List down the volumes
docker volume inspect my-vol inspect the volumes
docker volumes rm my-vol remove volume
docker run -d --name mycont -v my-vol:/app nginx:latest start container with -v flag (volume mount)
docker run -d --name devtest --mount source=my-vol,target=/app nginx:latest start container with --mount flag
docker run -d -it --name devtest -v "$(pwd)"/myfolder:/app nginx:latest start container with bind mounts and -v flag
docker run -d -it --name devtest --mount type=bind,source="$(pwd)"/myfolder,target=/app nginx:latest start container with bind mounts and -mount flag

piaic-docker-cnc's People

Contributors

fazzya avatar uqutub avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.