20250405 Deck3 Flashcards

1
Q

What are Linux namespaces in simple terms?

A

Namespaces are a Linux kernel feature that isolate resources (like processes, network, filesystems) so that a process thinks it’s running in its own independent environment.

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

Name 3 types of Linux namespaces used in containerization.

A

• pid – isolates process IDs
• net – isolates networking (interfaces, IPs)
• mnt – isolates mount points/filesystems

Also: user, uts, ipc, cgroup

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

What is the purpose of the unshare command in Linux?

A

It creates new namespaces for a process, allowing it to run with isolated system properties like hostname, network, or mount points.

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

What does unshare -u bash do?

A

It starts a new bash shell in a new UTS (hostname) namespace, allowing the user to change the hostname without affecting the rest of the system.

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

What is the UTS namespace used for in Linux?

A

It isolates the system’s hostname and domain name, allowing processes to set custom hostnames independently.

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

What are cgroups (control groups) in Linux?

A

Cgroups are a kernel feature that limit, track, and isolate the resource usage (CPU, memory, I/O, etc.) of groups of processes.

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

Give an example of how Docker uses cgroups.

A

When you run docker run --memory=512m --cpus=1, Docker uses cgroups to enforce those resource limits on the container.

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

What resources can be controlled with cgroups?

A

Memory, CPU, block I/O, number of processes (PIDs), and more.

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

What are Linux capabilities and why were they introduced?

A

Capabilities split root privileges into fine-grained units so that processes can be granted some powers (like binding to port 80) without full root access.

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

What does CAP_NET_BIND_SERVICE allow a process to do?

A

Bind to low-numbered ports (like 80 or 443) without full root privileges.

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

How do you give a Docker container permission to modify its own network settings?

A

Use --cap-add=NET_ADMIN when running the container.

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

What’s a secure way to run containers with limited privileges?

A

Drop all capabilities using --cap-drop=ALL, then add only the ones needed using --cap-add=....

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