2017-12-11 19:16:33 +00:00
# libpod Installation Instructions
2019-01-15 22:37:55 +00:00
## Installing packaged versions of Podman
2019-05-31 06:30:00 +00:00
#### [Arch Linux](https://www.archlinux.org) & [Manjaro Linux](https://manjaro.org)
2019-01-15 22:37:55 +00:00
2019-01-26 22:00:49 +00:00
```bash
sudo pacman -S podman
```
2019-01-15 22:37:55 +00:00
2019-05-06 05:44:45 +00:00
If you have problems when running Podman in [rootless ](README.md#rootless ) mode follow the instructions [here ](https://wiki.archlinux.org/index.php/Linux_Containers#Enable_support_to_run_unprivileged_containers_(optional ))
2019-04-28 20:17:18 +00:00
2019-01-15 22:37:55 +00:00
#### [Fedora](https://www.fedoraproject.org), [CentOS](https://www.centos.org)
```bash
sudo yum -y install podman
```
#### [Fedora-CoreOS](https://coreos.fedoraproject.org), [Fedora SilverBlue](https://silverblue.fedoraproject.org)
Built-in, no need to install
#### [Gentoo](https://www.gentoo.org)
```bash
sudo emerge app-emulation/libpod
```
#### [openSUSE](https://www.opensuse.org)
```bash
sudo zypper install podman
```
2019-01-17 19:25:21 +00:00
#### [openSUSE Kubic](https://kubic.opensuse.org)
Built-in, no need to install
2019-01-15 22:37:55 +00:00
#### [RHEL7](https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux)
2019-05-06 05:44:45 +00:00
Subscribe, then enable Extras channel and install Podman.
2019-01-15 22:37:55 +00:00
```bash
sudo subscription-manager repos --enable=rhel-7-server-extras-rpms
sudo yum -y install podman
```
#### [RHEL8 Beta](https://www.redhat.com/en/blog/powering-its-future-while-preserving-present-introducing-red-hat-enterprise-linux-8-beta?intcmp=701f2000001Cz6OAAS)
```bash
sudo yum module enable -y container-tools:1.0
sudo yum module install -y container-tools:1.0
```
2019-05-06 05:44:45 +00:00
### Installing development versions of Podman
2019-01-15 22:37:55 +00:00
#### [Ubuntu](https://www.ubuntu.com)
2019-05-06 05:44:45 +00:00
The latest builds are available in a PPA. Take note of the [Build and Run Dependencies ](#build-and-run-dependencies ) listed below if you run into any issues.
2019-01-15 22:37:55 +00:00
```bash
sudo apt-get update -qq
2019-04-12 18:26:48 +00:00
sudo apt-get install -qq -y software-properties-common uidmap
2019-01-15 22:37:55 +00:00
sudo add-apt-repository -y ppa:projectatomic/ppa
2019-04-11 21:14:40 +00:00
sudo apt-get update -qq
2019-01-15 22:37:55 +00:00
sudo apt-get -qq -y install podman
```
2019-05-06 05:44:45 +00:00
#### Fedora
2019-01-15 22:37:55 +00:00
2019-05-06 05:44:45 +00:00
You can test the very latest Podman in Fedora's `updates-testing`
repository before it goes out to all Fedora users.
2017-12-11 19:16:33 +00:00
2019-05-06 05:44:45 +00:00
```console
sudo yum distro-sync --enablerepo=updates-testing podman
```
2018-01-16 22:33:56 +00:00
2019-05-06 05:44:45 +00:00
If you use a newer Podman package from Fedora's `updates-testing` , we would
appreciate your `+1` feedback in [Bodhi, Fedora's update management
system](https://bodhi.fedoraproject.org/updates/?packages=podman).
2017-12-11 19:16:33 +00:00
2019-05-06 05:44:45 +00:00
## Building from scratch
2017-12-11 19:16:33 +00:00
### Build and Run Dependencies
**Required**
Fedora, CentOS, RHEL, and related distributions:
```bash
2019-05-06 05:44:45 +00:00
sudo yum install -y \
2018-02-15 12:31:46 +00:00
atomic-registries \
2017-12-11 19:16:33 +00:00
btrfs-progs-devel \
2018-01-26 22:43:11 +00:00
containernetworking-cni \
2017-12-11 19:16:33 +00:00
device-mapper-devel \
git \
glib2-devel \
glibc-devel \
glibc-static \
go \
golang-github-cpuguy83-go-md2man \
gpgme-devel \
2018-02-15 12:31:46 +00:00
iptables \
2017-12-11 19:16:33 +00:00
libassuan-devel \
libgpg-error-devel \
libseccomp-devel \
libselinux-devel \
2018-06-20 18:44:38 +00:00
make \
2017-12-11 19:16:33 +00:00
ostree-devel \
pkgconfig \
runc \
2019-03-05 18:27:30 +00:00
containers-common
2017-12-11 19:16:33 +00:00
```
Debian, Ubuntu, and related distributions:
```bash
2019-05-06 05:44:45 +00:00
sudo apt-get install \
2017-12-11 19:16:33 +00:00
btrfs-tools \
git \
golang-go \
2018-02-15 12:31:46 +00:00
go-md2man \
iptables \
2017-12-11 19:16:33 +00:00
libassuan-dev \
2019-05-06 05:44:45 +00:00
libc6-dev \
2017-12-11 19:16:33 +00:00
libdevmapper-dev \
libglib2.0-dev \
2019-05-06 05:44:45 +00:00
libgpgme-dev \
2017-12-11 19:16:33 +00:00
libgpg-error-dev \
2019-05-06 05:44:45 +00:00
libostree-dev \
2018-02-15 12:31:46 +00:00
libprotobuf-dev \
libprotobuf-c0-dev \
2017-12-11 19:16:33 +00:00
libseccomp-dev \
libselinux1-dev \
2019-05-06 05:44:45 +00:00
libsystemd-dev \
2019-04-12 18:26:48 +00:00
pkg-config \
2019-05-06 05:44:45 +00:00
runc \
2019-04-12 18:26:48 +00:00
uidmap
2017-12-11 19:16:33 +00:00
```
2019-05-31 06:30:00 +00:00
On Manjaro (and maybe other Linux distributions):
Make sure that the Linux kernel supports user namespaces:
```
> zgrep CONFIG_USER_NS /proc/config.gz
CONFIG_USER_NS=y
```
If not, please update the kernel.
2019-05-31 19:22:04 +00:00
For Manjaro Linux the instructions can be found here:
2019-05-31 06:30:00 +00:00
https://wiki.manjaro.org/index.php/Manjaro_Kernels
After that enable user namespaces:
```
sudo sysctl kernel.unprivileged_userns_clone=1
```
2019-06-09 12:34:31 +00:00
To enable the user namespaces permanenty:
```
echo 'kernel.unprivileged_userns_clone=1' > /etc/sysctl.d/userns.conf
```
2019-05-06 05:44:45 +00:00
### Building missing dependencies
2017-12-11 19:16:33 +00:00
2019-05-06 05:44:45 +00:00
If any dependencies cannot be installed or are not sufficiently current, they have to be built from source.
This will mainly affect Debian, Ubuntu, and related distributions, or RHEL where no subscription is active (e.g. Cloud VMs).
2017-12-11 19:16:33 +00:00
2019-05-06 05:44:45 +00:00
#### ostree
2017-12-11 19:16:33 +00:00
2019-05-06 05:44:45 +00:00
A copy of the development libraries for `ostree` is necessary, either in the form of the `libostree-dev` package
from the [flatpak ](https://launchpad.net/~alexlarsson/+archive/ubuntu/flatpak ) PPA,
or built [from source ](https://github.com/ostreedev/ostree/blob/master/docs/contributing-tutorial.md )
(see also [here ](https://ostree.readthedocs.io/en/latest/#building )). As of Ubuntu 18.04, `libostree-dev` is available in the main repositories,
and the PPA is no longer required.
2018-02-15 12:31:46 +00:00
2019-05-06 05:44:45 +00:00
To build, use the following (running `make` can take a while):
```bash
git clone https://github.com/ostreedev/ostree ~/ostree
cd ~/ostree
git submodule update --init
# for Fedora, CentOS, RHEL
sudo yum install -y automake bison e2fsprogs-devel fuse-devel libtool xz-devel zlib-devel
# for Debian, Ubuntu etc.
2019-05-24 03:07:02 +00:00
sudo apt-get install -y automake bison e2fsprogs e2fslibs-dev fuse libfuse-dev libgpgme-dev liblzma-dev libtool zlib1g
2019-05-06 05:44:45 +00:00
./autogen.sh --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc
# remove --nonet option due to https:/github.com/ostreedev/ostree/issues/1374
sed -i '/.*--nonet.*/d' ./Makefile-man.am
make
sudo make install
```
#### golang
Be careful to double-check that the version of golang is new enough (i.e. `go version` ), version 1.10.x or higher is required.
If needed, golang kits are available at https://golang.org/dl/. Alternatively, go can be built from source as follows
(it's helpful to leave the system-go installed, to avoid having to [bootstrap go ](https://golang.org/doc/install/source ):
```bash
export GOPATH=~/go
git clone https://go.googlesource.com/go $GOPATH
cd $GOPATH
git checkout tags/go1.10.8 # optional
cd src
./all.bash
export PATH=$GOPATH/bin:$PATH
```
2017-12-11 19:16:33 +00:00
2019-05-06 05:44:45 +00:00
#### conmon
The latest version of `conmon` is expected to be installed on the system. Conmon is used to monitor OCI Runtimes.
2019-05-17 22:02:29 +00:00
To build from source, use the following:
2019-05-06 05:44:45 +00:00
```bash
2019-05-17 22:02:29 +00:00
git clone https://github.com/containers/conmon
cd conmon
make
2019-06-21 18:38:22 +00:00
sudo make podman
2019-05-06 05:44:45 +00:00
```
#### runc
The latest version of `runc` is expected to be installed on the system. It is picked up as the default runtime by Podman.
Version 1.0.0-rc4 is the minimal requirement, which is available in Ubuntu 18.04 already.
To double-check, `runc --version` should produce at least `spec: 1.0.1` , otherwise build your own:
```bash
git clone https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
cd $GOPATH/src/github.com/opencontainers/runc
make BUILDTAGS="selinux seccomp"
sudo cp runc /usr/bin/runc
```
#### CNI plugins
```bash
git clone https://github.com/containernetworking/plugins.git $GOPATH/src/github.com/containernetworking/plugins
cd $GOPATH/src/github.com/containernetworking/plugins
./build_linux.sh
sudo mkdir -p /usr/libexec/cni
sudo cp bin/* /usr/libexec/cni
```
#### Setup CNI networking
A proper description of setting up CNI networking is given in the [`cni` README ](cni/README.md ).
Using the CNI plugins from above, a more basic network config is achieved with:
```bash
mkdir -p /etc/cni/net.d
curl -qsSL https://raw.githubusercontent.com/containers/libpod/master/cni/87-podman-bridge.conflist | sudo tee /etc/cni/net.d/99-loopback.conf
```
#### Add configuration
```bash
sudo mkdir -p /etc/containers
sudo curl https://raw.githubusercontent.com/projectatomic/registries/master/registries.fedora -o /etc/containers/registries.conf
sudo curl https://raw.githubusercontent.com/containers/skopeo/master/default-policy.json -o /etc/containers/policy.json
```
#### Optional packages
2017-12-11 19:16:33 +00:00
Fedora, CentOS, RHEL, and related distributions:
(no optional packages)
Debian, Ubuntu, and related distributions:
```bash
apt-get install -y \
libapparmor-dev
```
### Get Source Code
2019-05-06 05:44:45 +00:00
As with other Go projects, Podman must be cloned into a directory structure like:
2017-12-11 19:16:33 +00:00
```
GOPATH
└── src
└── github.com
2019-05-06 05:44:45 +00:00
└── containers
└── libpod
2017-12-11 19:16:33 +00:00
```
2019-05-06 05:44:45 +00:00
First, ensure that the go version that is found first on the $PATH (in case you built your own; see [above ](#golang )) is sufficiently recent -
`go version` must be higher than 1.10.x). Then we can finally build Podman (assuming we already have a `$GOPATH` and the corresponding folder,
`export GOPATH=~/go && mkdir -p $GOPATH` ):
2017-12-11 19:16:33 +00:00
```bash
2019-05-06 05:44:45 +00:00
git clone https://github.com/containers/libpod/ $GOPATH/src/github.com/containers/libpod
cd $GOPATH/src/github.com/containers/libpod
make BUILDTAGS="selinux seccomp"
2019-05-18 19:55:04 +00:00
sudo make install PREFIX=/usr
2017-12-11 19:16:33 +00:00
```
2019-05-06 05:44:45 +00:00
#### Build Tags
2017-12-11 19:16:33 +00:00
2019-05-06 05:44:45 +00:00
Otherwise, if you do not want to build Podman with seccomp or selinux support you can add `BUILDTAGS=""` when running make.
2017-12-11 19:16:33 +00:00
```bash
make BUILDTAGS=""
sudo make install
```
2019-05-06 05:44:45 +00:00
Podman supports optional build tags for compiling support of various features.
To add build tags to the make option the `BUILDTAGS` variable must be set, for example:
2017-12-11 19:16:33 +00:00
```bash
make BUILDTAGS='seccomp apparmor'
```
| Build Tag | Feature | Dependency |
|-----------|------------------------------------|-------------|
| seccomp | syscall filtering | libseccomp |
| selinux | selinux process and mount labeling | libselinux |
| apparmor | apparmor profile support | libapparmor |
2018-06-22 18:41:02 +00:00
2019-02-07 12:18:31 +00:00
### Vendoring - Dependency Management
2019-06-24 09:29:13 +00:00
This project is using [go modules ](https://github.com/golang/go/wiki/Modules ) for dependency management. If the CI is complaining about a pull request leaving behind an unclean state, it is very likely right about it. After changing dependencies, make sure to run `make vendor` to synchronize the code with the go module and repopulate the `./vendor` directory.
2019-02-07 12:18:31 +00:00
2018-06-22 18:41:02 +00:00
## Configuration files
### [registries.conf](https://src.fedoraproject.org/rpms/skopeo/blob/master/f/registries.conf)
#### Man Page: [registries.conf.5](https://github.com/containers/image/blob/master/docs/registries.conf.5.md)
`/etc/containers/registries.conf`
registries.conf is the configuration file which specifies which container registries should be consulted when completing image names which do not include a registry or domain portion.
#### Example from the Fedora `containers-common` package
```
cat /etc/containers/registries.conf
# This is a system-wide configuration file used to
# keep track of registries for various container backends.
# It adheres to TOML format and does not support recursive
# lists of registries.
# The default location for this configuration file is /etc/containers/registries.conf.
# The only valid categories are: 'registries.search', 'registries.insecure',
# and 'registries.block'.
[registries.search]
registries = ['docker.io', 'registry.fedoraproject.org', 'quay.io', 'registry.access.redhat.com', 'registry.centos.org']
# If you need to access insecure registries, add the registry's fully-qualified name.
# An insecure registry is one that does not have a valid SSL certificate or only does HTTP.
[registries.insecure]
registries = []
# If you need to block pull access from a registry, uncomment the section below
# and add the registries fully-qualified name.
#
[registries.block]
registries = []
```
### [mounts.conf](https://src.fedoraproject.org/rpms/skopeo/blob/master/f/mounts.conf)
`/usr/share/containers/mounts.conf` and optionally `/etc/containers/mounts.conf`
The mounts.conf files specify volume mount directories that are automatically mounted inside containers when executing the `podman run` or `podman build` commands. Container process can then use this content. The volume mount content does not get committed to the final image.
Usually these directories are used for passing secrets or credentials required by the package software to access remote package repositories.
For example, a mounts.conf with the line "`/usr/share/rhel/secrets:/run/secrets`", the content of `/usr/share/rhel/secrets` directory is mounted on `/run/secrets` inside the container. This mountpoint allows Red Hat Enterprise Linux subscriptions from the host to be used within the container.
Note this is not a volume mount. The content of the volumes is copied into container storage, not bind mounted directly from the host.
#### Example from the Fedora `containers-common` package:
```
cat /usr/share/containers/mounts.conf
/usr/share/rhel/secrets:/run/secrets
```
### [seccomp.json](https://src.fedoraproject.org/rpms/skopeo/blob/master/f/seccomp.json)
`/usr/share/containers/seccomp.json`
seccomp.json contains the whitelist of seccomp rules to be allowed inside of
containers. This file is usually provided by the containers-common package.
The link above takes you to the seccomp.json
2018-08-18 14:50:50 +00:00
### [policy.json](https://github.com/containers/skopeo/blob/master/default-policy.json)
2018-06-22 18:41:02 +00:00
`/etc/containers/policy.json`
#### Man Page: [policy.json.5](https://github.com/containers/image/blob/master/docs/policy.json.md)
#### Example from the Fedora `containers-common` package:
```
cat /etc/containers/policy.json
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}
```