Setting up firewall
Docker requires legacy iptables
to configure firewall rules for it's interfaces. To switch iptables
to legacy run following command:
update-alternatives --set iptables /usr/sbin/iptables-legacy
Installing docker
To install docker run following command:
sudo apt update sudo apt install docker.io
Running docker
To start docker daemon run:
sudo systemctl start docker
To check everything is working, run docker info:
user@imx8mpnavq:~$ sudo docker info Client: Context: default Debug Mode: false Server: Containers: 3 Running: 0 Paused: 0 Stopped: 3 Images: 1 Server Version: 20.10.21 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: systemd Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux Default Runtime: runc Init Binary: docker-init containerd version: runc version: init version: Security Options: seccomp Profile: default cgroupns Kernel Version: 5.15.71-0.0.1-355-07080005-53a60de8e5+g2ef8cc43ed08 Operating System: Ubuntu 22.04.1 LTS OSType: linux Architecture: aarch64 CPUs: 4 Total Memory: 3.544GiB Name: imx8mpnavq ID: HGBJ:23QS:K5Z2:TP6B:BULI:PEWO:AD5X:ZMTM:MLKL:XOQQ:GUZO:HCQN Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false
Running “Hello, world!”
Pull and run the first container, “hello-world”:
sudo docker run hello-world
Post-install configuration
If you want to run docker without root privileges, add user to the docker
group:
sudo usermod -aG docker $USER
After you log out and log back, you can run docker commands without sudo
:
user@imx8mpnavq:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES