Commands Flashcards

1
Q

docker build -t friendlyname .

A

Create image using this directory’s Dockerfile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

docker run -p 4000:80 friendlyname

A

Run “friendlyname” mapping port 4000 to 80

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

docker run -d -p 4000:80 friendlyname

A

Same thing, but in detached mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

docker ps

A

See a list of all running containers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

docker stop

A

Gracefully stop the specified container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

docker ps -a

A

See a list of all containers, even the ones not running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

docker kill

A

Force shutdown of the specified container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

docker rm

A

Remove the specified container from this machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

docker rm $(docker ps -a -q)

A

Remove all containers from this machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

docker images -a

A

Show all images on this machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

docker rmi

A

Remove the specified image from this machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

docker rmi $(docker images -q)

A

Remove all images from this machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

docker login

A

Log in this CLI session using your Docker credentials

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

docker tag username/repository:tag

A

Tag for upload to registry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

docker push username/repository:tag

A

Upload tagged image to registry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

docker run username/repository:tag

A

Run image from a registry

17
Q

docker stack ls

A

List all running applications on this Docker host

18
Q

docker stack deploy -c

A

Run the specified Compose file

19
Q

docker stack services

A

List the services associated with an app

20
Q

docker stack ps

A

List the running containers associated with an app

21
Q

docker stack rm

A

Tear down an application

22
Q

docker-machine create –driver virtualbox myvm1

A

Create a VM (Mac, Win7, Linux)

23
Q

docker-machine create -d hyperv –hyperv-virtual-switch “myswitch” myvm1

A

Create a VM (Win10)

24
Q

docker-machine env myvm1

A

View basic information about your node

25
Q

docker-machine ssh myvm1 “docker node ls”

A

List the nodes in your swarm

26
Q

docker-machine ssh myvm1 “docker node inspect “

A

Inspect a node

27
Q

docker-machine ssh myvm1 “docker swarm join-token -q worker”

A

View join token

28
Q

docker-machine ssh myvm1

A

Open an SSH session with the VM; type “exit” to end

29
Q

docker-machine ssh myvm2 “docker swarm leave”

A

Make the worker leave the swarm

30
Q

docker-machine ssh myvm1 “docker swarm leave -f”

A

Make master leave, kill swarm

31
Q

docker-machine start myvm1

A

Start a VM that is currently not running

32
Q

docker-machine stop $(docker-machine ls -q)

A

Stop all running VMs

33
Q

docker-machine rm $(docker-machine ls -q)

A

Delete all VMs and their disk images

34
Q

docker-machine scp docker-compose.yml myvm1:~

A

Copy file to node’s home dir

35
Q

docker-machine ssh myvm1 “docker stack deploy -c “

A

Deploy an app