forked from labtraining/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_excercise1.txt
More file actions
63 lines (56 loc) · 4.42 KB
/
Copy pathdocker_excercise1.txt
File metadata and controls
63 lines (56 loc) · 4.42 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
1. Update your system as appropriate for the distribution you are using. Use the instructions in the videos OR on the Docker site to add the DOCKER repository for installing the latest copy of Docker for your distribution and version.
2. Using the appropriate package management commands, install the 'docker' package. Once installed, enable the service so that it starts upon reboot. Additionally, start the 'docker' service and verify it is running.
3. Enable the non-root users to run 'docker' commands on the system. Create the appropriate group, add the users you want to have access to 'docker' commands, restart the 'docker' service and verify that non-root users can run basic 'docker' commands.
4. Once 'docker' is installed and non-root users can run commands, use the appropriate 'docker' commands and options to download the latest available image in the public repository for Ubuntu. Once downloaded and installed, verify the image appears in the local base image list.
5. Start a container based upon the Ubuntu base image downloaded in Step #4. When you start the container, start it connected to the current terminal, in interactive mode, starting the bash shell for you to connect to. You may exit the container at that time.
1. Update your system as appropriate for the distribution you are using. Use the instructions in the videos OR on the Docker site to add the DOCKER repository for installing the latest copy of Docker for your distribution and version.
[user@linuxacademy:~] sudo yum update (or upgrade)
[user@linuxacademy:~] cat /etc/yum.repos.d/docker.repo
[docker-repo]
name=Docker Repo
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
2. Using the appropriate package management commands, install the 'docker' package. Once installed, enable the service so that it starts upon reboot. Additionally, start the 'docker' service and verify it is running.
[user@linuxacademy:~] sudo yum -y install docker-engine
(Output) Package downloads and installs here
CentOS 7.x SOLUTION
[user@linuxacademy:~] sudo systemctl enable docker
[user@linuxacademy:~] sudo systemctl start docker
[user@linuxacademy:~] ps aux | grep docker
(Output)
root 5802 0.0 0.3 346424 12936 ? Ssl 21:02 0:00 /usr/bin/docker -d --selinux-enabled
(Output)
3. Enable the non-root users to run 'docker' commands on the system. Create the appropriate group, add the users you want to have access to 'docker' commands, restart the 'docker' service and verify that non-root users can run basic 'docker' commands.
[user@linuxacademy:~] sudo groupadd docker
[user@linuxacademy:~] vim /etc/group
(Output)...
Find the line that looks like: docker:x:1001:
Add the 'user' user to the end of that line (after the :)
(Output)...
[user@linuxacademy:~] sudo service docker restart (OR sudo systemctl restart docker)
[user@linuxacademy:~] docker images
(Output)
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
(Output)
4. Once 'docker' is installed and non-root users can run commands, use the appropriate 'docker' commands and options to download the latest available image in the public repository for Ubuntu. Once downloaded and installed, verify the image appears in the local base image list.
[user@linuxacademy:~] docker pull ubuntu:latest
(Output) NOTE: Your output may differ if image has been updated
latest: Pulling from docker.io/ubuntu
6071b4945dcf: Pull complete
5bff21ba5409: Pull complete
e5855facec0b: Pull complete
8251da35e7a7: Pull complete
Digest: sha256:1572e29178048ad9ab72e78edd4decc91a3d8a8dea0ca39817efc7cf2d86c6d7
Status: Downloaded newer image for docker.io/ubuntu:latest
(Output)...
[user@linuxacademy:~] docker images
(Output) NOTE: Again, your output may differ slightly
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
docker.io/ubuntu latest 8251da35e7a7 11 days ago 188.3 MB
(Output)...
5. Start a container based upon the Ubuntu base image downloaded in Step #4. When you start the container, start it connected to the current terminal, in interactive mode, starting the bash shell for you to connect to. You may exit the container at that time.
[user@linuxacademy:~] docker run -it docker.io/ubuntu:latest /bin/bash
(Output) NOTE: Your output will differ based on the container ID assigned
root@7aaf3de3ed4f:/# exit