Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docker_installation_on_fedora [2019/01/24 10:05] – [Registering the Docker repository] rpjdaydocker_installation_on_fedora [2019/01/24 14:01] (current) – [Installing Docker and Docker Compose] rpjday
Line 2: Line 2:
  
 How to install and test Docker and friends on current Fedora 29. How to install and test Docker and friends on current Fedora 29.
 +
 +Extra:
 +
 +  * ''curl -fsSL get.docker.com -o get-docker.sh''
 +
 ===== Links ===== ===== Links =====
  
Line 9: Line 14:
       * [[https://docs.docker.com/install/linux/linux-postinstall/|Post-installation steps for Linux]]       * [[https://docs.docker.com/install/linux/linux-postinstall/|Post-installation steps for Linux]]
  
-===== Get rid of any earlier Docker packages =====+===== Get rid of earlier Docker/container content =====
  
 Fedora's Docker packaging has undergone some reorganization, so you first need to get rid of all earlier Docker-related packages. First, take a quick look at what Docker-related packages are already installed: Fedora's Docker packaging has undergone some reorganization, so you first need to get rid of all earlier Docker-related packages. First, take a quick look at what Docker-related packages are already installed:
Line 38: Line 43:
     docker-engine     docker-engine
 $ $
 +</code>
 +
 +or possibly just:
 +
 +<code>
 +$ sudo dnf remove "*docker*"
 </code> </code>
  
Line 60: Line 71:
 <code> <code>
 $ dnf repoquery --repo=docker-ce-stable $ dnf repoquery --repo=docker-ce-stable
-Docker CE Stable - x86_64                                      1.6 kB/s | 3.6 kB     00:02     
 containerd.io-0:1.2.2-3.fc29.x86_64 containerd.io-0:1.2.2-3.fc29.x86_64
 docker-ce-3:18.09.1-3.fc29.x86_64 docker-ce-3:18.09.1-3.fc29.x86_64
Line 72: Line 82:
  
 <code> <code>
-$ sudo dnf install docker-ce docker-compose+$ sudo dnf install docker-ce [docker-compose]
 </code> </code>
  
-You should then start and enable the Docker daemon (if it isn't already):+resulting in: 
 + 
 +<code> 
 +Installing: 
 + containerd.io         x86_64         1.2.2-3.fc29              docker-ce-stable 
 +     replacing  runc.x86_64 2:1.0.0-66.dev.gitbbb17ef.fc29 
 + docker-ce             x86_64         3:18.09.1-3.fc29          docker-ce-stable 
 +Installing dependencies: 
 + docker-ce-cli         x86_64         1:18.09.1-3.fc29          docker-ce-stable 
 + libcgroup             x86_64         0.41-20.fc29              fedora 
 +</code> 
 + 
 +Should create group ''docker''
 +===== Docker RPM scripts ===== 
 + 
 +==== preinstall ==== 
 + 
 +<code> 
 +if [ $1 -gt 0 ] ; then 
 +    # package upgrade scenario, before new files are installed 
 + 
 +    # clear any old state 
 +    rm -f /var/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : 
 + 
 +    # check if docker service is running 
 +    if systemctl is-active docker > /dev/null 2>&1; then 
 +        systemctl stop docker > /dev/null 2>&1 || : 
 +        touch /var/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : 
 +    fi 
 +fi 
 +</code> 
 + 
 +==== postinstall ==== 
 + 
 +<code> 
 +if [ $1 -eq 1 ] ; then  
 +        # Initial installation  
 +        systemctl --no-reload preset docker &>/dev/null || :  
 +fi  
 + 
 +if ! getent group docker > /dev/null; then 
 +    groupadd --system docker 
 +fi 
 +... EE stuff snipped ... 
 +</code> 
 + 
 +==== preuninstall ==== 
 + 
 +<code> 
 +if [ $1 -eq 0 ] ; then 
 +        # Package removal, not upgrade 
 +        systemctl --no-reload disable --now docker &>/dev/null || : 
 +fi 
 + 
 +update-alternatives --remove dockerd /usr/bin/dockerd || true 
 +</code> 
 +==== postuninstall ==== 
 + 
 +<code> 
 +if [ $1 -ge 1 ] ; then 
 +        # Package upgrade, not uninstall 
 +        systemctl try-restart docker &>/dev/null || : 
 +fi 
 +</code> 
 +===== Starting Docker ===== 
 + 
 +<code> 
 +$ systemctl status docker.service 
 +● docker.service - Docker Application Container Engine 
 +   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) 
 +   Active: inactive (dead) 
 +     Docs: https://docs.docker.com 
 +
 +</code>
  
 <code> <code>
Line 86: Line 169:
 <code> <code>
 $ systemctl status docker $ systemctl status docker
 +● docker.service - Docker Application Container Engine
 +   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
 +   Active: active (running) since Thu 2019-01-24 05:45:18 EST; 6s ago
 +     Docs: https://docs.docker.com
 + Main PID: 16470 (dockerd)
 +    Tasks: 46
 +   Memory: 58.3M
 +   CGroup: /system.slice/docker.service
 +           ├─16470 /usr/bin/dockerd -H fd://
 +           └─16496 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
 +$
 </code> </code>
  
-Finally, you can test your installation with:+===== Testing installation =====
  
 <code> <code>
 $ sudo docker run hello-world $ sudo docker run hello-world
 +Unable to find image 'hello-world:latest' locally
 +latest: Pulling from library/hello-world
 +1b930d010525: Pull complete 
 +Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
 +Status: Downloaded newer image for hello-world:latest
  
 Hello from Docker! Hello from Docker!
Line 109: Line 208:
  
 Share images, automate workflows, and more with a free Docker ID: Share images, automate workflows, and more with a free Docker ID:
- https://cloud.docker.com/+ https://hub.docker.com/
  
 For more examples and ideas, visit: For more examples and ideas, visit:
- https://docs.docker.com/engine/userguide/+ https://docs.docker.com/get-started/
 $ $
 </code> </code>
Line 138: Line 237:
 $ docker run hello-world $ docker run hello-world
 ... etc etc ... ... etc etc ...
 +</code>
 +
 +===== Running Ubuntu bash =====
 +
 +<code>
 +$ docker run -it ubuntu bash
 +Unable to find image 'ubuntu:latest' locally
 +latest: Pulling from library/ubuntu
 +38e2e6cd5626: Pull complete 
 +705054bc3f5b: Pull complete 
 +c7051e069564: Pull complete 
 +7308e914506c: Pull complete 
 +Digest: sha256:945039273a7b927869a07b375dc3148de16865de44dec8398672977e050a072e
 +Status: Downloaded newer image for ubuntu:latest
 +root@f7c76c6f0ee4:/# id
 +uid=0(root) gid=0(root) groups=0(root)
 +root@f7c76c6f0ee4:/# 
 +</code>
 +
 +From another session:
 +
 +<code>
 +# docker ps
 +CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
 +f7c76c6f0ee4        ubuntu              "bash"              25 seconds ago      Up 22 seconds                           nifty_spence
 </code> </code>
  • docker_installation_on_fedora.1548324300.txt.gz
  • Last modified: 2019/01/24 10:05
  • by rpjday