Skip to content

Commit 99959e5

Browse files
TomSweeneyRedHatrh-atomic-bot
authored andcommitted
Fix nits and GOPATH in tutorial
Signed-off-by: TomSweeneyRedHat <[email protected]> Closes: #1052 Approved by: baude
1 parent 4f0c059 commit 99959e5

File tree

1 file changed

+47
-36
lines changed

1 file changed

+47
-36
lines changed

docs/tutorials/podman_tutorial.md

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ commands with Podman.
77

88
## Install Podman on Fedora from RPM Repositories
99
Fedora 27 and later provide Podman via the package manager.
10-
```
10+
```console
1111
$ sudo dnf install -y podman
1212
```
1313

@@ -17,17 +17,23 @@ In this section, we will help you install all the runtime and build dependencies
1717
acquire the source, and build it.
1818

1919
### Installing build and runtime dependencies
20-
```
20+
```console
2121
$ sudo dnf install -y git runc libassuan-devel golang golang-github-cpuguy83-go-md2man glibc-static \
2222
gpgme-devel glib2-devel device-mapper-devel libseccomp-devel \
2323
atomic-registries iptables skopeo-containers containernetworking-cni \
2424
conmon
2525
```
2626
### Building and installing podman
27-
```
28-
# git clone https://github.com/projectatomic/libpod/ ~/src/github.com/projectatomic/libpod
29-
# cd !$
30-
# make
27+
28+
First, configure a `GOPATH` (if you are using go1.8 or later, this defaults to `~/go`), then clone
29+
and make libpod.
30+
31+
```console
32+
$ export GOPATH=~/go
33+
$ mkdir -p $GOPATH
34+
$ git clone https://github.com/projectatomic/libpod/ $GOPATH/src/github.com/projectatomic/libpod
35+
$ cd $GOPATH/src/github.com/projectatomic/libpod
36+
$ make
3137
$ sudo make install PREFIX=/usr
3238
```
3339

@@ -43,46 +49,51 @@ tutorial. For this tutorial, the Ubuntu **artful-server-cloudimg** image was use
4349
### Installing build and runtime dependencies
4450

4551
#### Installing base packages
46-
```
52+
```console
4753
$ sudo apt-get update
4854
$ sudo apt-get install libdevmapper-dev libglib2.0-dev libgpgme11-dev golang libseccomp-dev \
49-
go-md2man libprotobuf-dev libprotobuf-c0-dev libseccomp-dev
55+
go-md2man libprotobuf-dev libprotobuf-c0-dev libseccomp-dev python3-setuptools
5056
```
5157
#### Building and installing conmon
52-
```
53-
# git clone https://github.com/kubernetes-incubator/cri-o ~/src/github.com/kubernetes-incubator/cri-o
54-
# cd ~/src/github.com/kubernetes-incubator/cri-o
55-
# mkdir bin
56-
# make conmon
58+
First, configure a `GOPATH` (if you are using go1.8 or later, this defaults to `~/go`), then clone
59+
and make libpod.
60+
61+
```console
62+
$ export GOPATH=~/go
63+
$ mkdir -p $GOPATH
64+
$ git clone https://github.com/kubernetes-incubator/cri-o $GOPATH/src/github.com/kubernetes-incubator/cri-o
65+
$ cd $GOPATH/src/github.com/kubernetes-incubator/cri-o
66+
$ mkdir bin
67+
$ make bin/conmon
5768
$ sudo install -D -m 755 bin/conmon /usr/libexec/podman/conmon
5869
```
5970
#### Adding required configuration files
60-
```
71+
```console
6172
$ sudo mkdir -p /etc/containers
6273
$ sudo curl https://raw.githubusercontent.com/projectatomic/registries/master/registries.fedora -o /etc/containers/registries.conf
6374
$ sudo curl https://raw.githubusercontent.com/projectatomic/skopeo/master/default-policy.json -o /etc/containers/policy.json
6475
```
6576
#### Installing CNI plugins
66-
```
67-
# git clone https://github.com/containernetworking/plugins.git ~/src/github.com/containernetworking/plugins
68-
# cd ~/src/github.com/containernetworking/plugins
69-
# ./build.sh
77+
```console
78+
$ git clone https://github.com/containernetworking/plugins.git $GOPATH/src/github.com/containernetworking/plugins
79+
$ cd $GOPATH/src/github.com/containernetworking/plugins
80+
$ ./build.sh
7081
$ sudo mkdir -p /usr/libexec/cni
7182
$ sudo cp bin/* /usr/libexec/cni
7283
```
7384
#### Installing runc
74-
```
75-
# git clone https://github.com/opencontainers/runc.git ~/src/github.com/opencontainers/runc
76-
# cd ~/src/github.com/opencontainers/runc
77-
# GOPATH=~/ make static BUILDTAGS="seccomp selinux"
85+
```console
86+
$ git clone https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
87+
$ cd $GOPATH/src/github.com/opencontainers/runc
88+
$ make static BUILDTAGS="seccomp selinux"
7889
$ sudo cp runc /usr/bin/runc
7990
```
8091

8192
### Building and installing Podman
82-
```
83-
# git clone https://github.com/projectatomic/libpod/ ~/src/github.com/projectatomic/libpod
84-
# cd ~/src/github.com/projectatomic/libpod
85-
# make
93+
```console
94+
$ git clone https://github.com/projectatomic/libpod/ $GOPATH/src/github.com/projectatomic/libpod
95+
$ cd $GOPATH/src/github.com/projectatomic/libpod
96+
$ make
8697
$ sudo make install PREFIX=/usr
8798
```
8899

@@ -91,26 +102,26 @@ $ sudo make install PREFIX=/usr
91102
### Running a sample container
92103
This sample container will run a very basic httpd server that serves only its index
93104
page.
94-
```
105+
```console
95106
$ sudo podman run -dt -e HTTPD_VAR_RUN=/var/run/httpd -e HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d \
96107
-e HTTPD_MAIN_CONF_PATH=/etc/httpd/conf \
97108
-e HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/ \
98-
registry.fedoraproject.org/f26/httpd /usr/bin/run-httpd
109+
registry.fedoraproject.org/f27/httpd /usr/bin/run-httpd
99110
```
100111
Because the container is being run in detached mode, represented by the *-d* in the podman run command, podman
101112
will print the container ID after it has run.
102113

103114
### Listing running containers
104115
The Podman *ps* command is used to list creating and running containers.
105-
```
116+
```console
106117
$ sudo podman ps
107118
```
108119

109120
Note: If you add *-a* to the *ps* command, Podman will show all containers.
110121
### Inspecting a running container
111122
You can "inspect" a running container for metadata and details about itself. We can even use
112123
the inspect subcommand to see what IP address was assigned to the container.
113-
```
124+
```console
114125
$ sudo podman inspect -l | grep IPAddress\":
115126
"IPAddress": "10.88.6.140",
116127
```
@@ -122,13 +133,13 @@ of -l.
122133
Now that we have the IP address of the container, we can test the network communication between the host
123134
operating system and the container using curl. The following command should display the index page of our
124135
containerized httpd server.
125-
```
136+
```console
126137
# curl http://<IP_address>:8080
127138
```
128139

129140
### Viewing the container's logs
130141
You can view the container's logs with Podman as well:
131-
```
142+
```console
132143
$ sudo podman logs --latest
133144
10.88.0.1 - - [07/Feb/2018:15:22:11 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.55.1" "-"
134145
10.88.0.1 - - [07/Feb/2018:15:22:30 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.55.1" "-"
@@ -139,7 +150,7 @@ $ sudo podman logs --latest
139150

140151
### Viewing the container's pids
141152
And you can observe the httpd pid in the container with *top*.
142-
```
153+
```console
143154
$ sudo podman top <container_id>
144155
UID PID PPID C STIME TTY TIME CMD
145156
0 31873 31863 0 09:21 ? 00:00:00 nginx: master process nginx -g daemon off;
@@ -148,18 +159,18 @@ $ sudo podman top <container_id>
148159

149160
### Stopping the container
150161
To stop the httpd container:
151-
```
162+
```console
152163
$ sudo podman stop --latest
153164
```
154165
You can also check the status of one or more containers using the *ps* subcommand. In this case, we should
155166
use the *-a* argument to list all containers.
156-
```
167+
```console
157168
$ sudo podman ps -a
158169
```
159170

160171
### Removing the container
161172
To remove the httpd container:
162-
```
173+
```console
163174
$ sudo podman rm --latest
164175
```
165176
You can verify the deletion of the container by running *podman ps -a*.

0 commit comments

Comments
 (0)