felixivance / node-docker

This is a project to learn docker & Kubernetes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

To run the image, run the following on terminal

1. build the image first by runnning (from the root directory)

~ docker build .

2. Then expose the image to your local machine  (first port is your local machine, then the next one is the docker image, --rm removes once completed)

docker run -p 3000:80 xxxx --rm (image name)

3. Browse your computer / browser to 

localhost:3000 


4. To stop the image from runnning

Run 

docker ps -a

5. to find the running image copy the name, then run 

docker stop xxxx (image name)

6. image is successfully stopped.

NB:

if code is changed you have to build the image whole again

7. List images
docker images

8. Remove image
docker rmi xxxx (image name)

9. Remove all images
docker rmi $(docker images -a -q)

10. Remove all containers
docker rm $(docker ps -a -q)

11. Remove all images and containers
docker system prune -a

12. Remove all stopped containers
docker rm $(docker ps -a -q)

13. Tag a docker image

docker tag xxxx (image name) xxxx (image name)

14. analyze docker image

docker xxxx inspect  (image name)

15. Run docker image in background

docker run -d -p 3000:80 --rm xxxx (image name)

16. Start an existing docker image

docker start xxxx (image name)

17. to see the logs of a running docker image

docker logs xxxx (image name)

18. to see the logs of a running docker image in real time

docker logs -f xxxx (image name)

19. starting docker in attach mode

docker start -a xxxx (image name)

20. docker start in interactive mode

docker run -it xxxx (image name) / docker start -a -i xxxx (image name)

21. remove all stopped containers

docker rm $(docker ps -a -q)

22. remove all images

docker rmi $(docker images -a -q)

23. copy files from local to docker image

docker cp xxxx (image name):/path/to/file /path/to/file

24. copy files from docker image to local

docker cp /path/to/file xxxx (image name):/path/to/file

About

This is a project to learn docker & Kubernetes


Languages

Language:JavaScript 51.2%Language:CSS 30.5%Language:Dockerfile 18.3%