-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_info.txt
More file actions
41 lines (24 loc) · 1.15 KB
/
docker_info.txt
File metadata and controls
41 lines (24 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
========= INTERACTING WITH DOCKER ========
USEFUL FACTS:
- When you run a container, make edits while in it, and then stop it, - all the changes you made DO NOT persist
BASIC COMMANDS:
- docker images: shows all the images that exist on your machine
- docker ps -a: lists all the containers that are created (running or stopped)
- docker rm <ID>: removes the container with that id
- docker rmi <ID>: removes the image with that id
BUILDING THE DOCKER IMAGE:
- COMMAND: docker build -t compfit_server .
- builds the image from the dockerfile within the current directory (thats the .)
- -t gives it the name
VOLUMES:
- allows changes within the container to persist
- COMMAND: docker volume create todo-db
- this creates a volume
- then it must be mounted onto a directory within our machine
CREATING A DOCKERFILE:
RUNNING THE IMAGE -> which creates the container:
- when you run the image, it makes a container that you can access
- must map the ports to access the application
- FLAG: -p 3000:3000
- maps the host port to the containers port
- docker run <image-name>: builds the image and then allows you to access the container