[core@tutorial ~]$ cat /etc/redhat-release
Fedora release 32 (Thirty Two)
[core@tutorial ~]$ cat /etc/os-release
NAME=Fedora
VERSION="32.20200923.3.0 (CoreOS)"
ID=fedora
VERSION_ID=32
VERSION_CODENAME=""
PLATFORM_ID="platform:f32"
PRETTY_NAME="Fedora CoreOS 32.20200923.3.0"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:32"
HOME_URL="https://getfedora.org/coreos/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora-coreos/"
SUPPORT_URL="https://github.com/coreos/fedora-coreos-tracker/"
BUG_REPORT_URL="https://github.com/coreos/fedora-coreos-tracker/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=32
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=32
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="CoreOS"
VARIANT_ID=coreos
OSTREE_VERSION='32.20200923.3.0'
[core@tutorial ~]$ nmcli con show
NAME UUID TYPE DEVICE
Wired Connection e1fb8b00-3905-4e08-aecb-fdd212690515 ethernet enp0s3
$ ll /etc/sysconfig/network-scripts/
total 0
$ ip a | grep 192.168.1
inet 192.168.1.18/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s3
$ nmcli connection show 'Wired Connection' | grep ipv4.addresses
ipv4.addresses: 192.168.1.18/24
$ sudo nmcli connection mod 'Wired Connection' \
ipv4.method manual \
ipv4.addresses 192.168.1.20/24 \
ipv4.gateway 192.168.1.1 \
ipv4.dns 192.168.1.1 \
connection.autoconnect yes
$ nmcli connection show 'Wired Connection' | grep ipv4.addresses
ipv4.addresses: 192.168.1.18/24
$ nmcli connection show 'Wired Connection' | grep ipv4.addresses
ipv4.addresses: 192.168.1.20/24
$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
$ sudo systemctl start docker
$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-10-07 03:50:03 UTC; 3s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 2398 (dockerd)
Tasks: 16 (limit: 1076)
Memory: 175.1M
CGroup: /system.slice/docker.service
├─2398 /usr/bin/dockerd --host=fd:// --exec-opt native.cgroupdriver=systemd --selinux-enabled --log-driver=journald --storage-driver=overlay2 --live-restore --d>
└─2403 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
$ sudo docker run -it busybox
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
df8698476c65: Pull complete
Digest: sha256:d366a4665ab44f0648d7a00ae3fae139d55e32f9712c67accd604bb55df9d05a
Status: Downloaded newer image for busybox:latest
/ # hostname
c970dc6c1f75
/ # exit
$ sudo docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 6858809bf669 4 weeks ago 1.23MB
$ podman run -it busybox
Trying to pull registry.fedoraproject.org/busybox...
manifest unknown: manifest unknown
Trying to pull registry.access.redhat.com/busybox...
name unknown: Repo not found
Trying to pull registry.centos.org/busybox...
manifest unknown: manifest unknown
Trying to pull docker.io/library/busybox...
Getting image source signatures
Copying blob df8698476c65 done
Copying config 6858809bf6 done
Writing manifest to image destination
Storing signatures
/ # exit
$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest 6858809bf669 4 weeks ago 1.45 MB
在CoreOS中只提供了最基础的系统级命令,其它功能都建议通过Container运行,而不是直接安装运行在CoreOS系统中。为此CoreOS提供了名为toolbox的命令,它会根据CoreOS环境参数(通常)下载并运行对应的toolbox容器镜像(RedHat CoreOS和Fedora CoreOS的默认toolbox镜像不同)。toolbox容器在运行起来后会自动将宿主CoreOS的分区挂载到toolbox容器中,这样我们就可以在toolbox容器中访问宿主CoreOS的目录和文件了。我们可以在toolbox容器中使用yum安装CoreOS中没有的命令或工具,以提高可操作性。
CoreOS缺省提供了toolbox命令,但是没包括toolbox对应的容器。在第一次运行toolbox命令的时候,CoreOS会自动下载由缺省参数指定的toolbox容器镜像。
[core@tutorial ~]$ /bin/toolbox create
Image required to create toolbox container.
Download registry.fedoraproject.org/f32/fedora-toolbox:32 (500MB)? [y/N]: y
Created container: fedora-toolbox-32
Enter with: toolbox enter
[core@tutorial ~]$ toolbox enter
/usr/bin/id: cannot find name for group ID 1000
Welcome to the Toolbox; a container where you can install and run
all your tools.
-- Use DNF in the usual manner to install command line tools.
-- To create a new tools container, run 'toolbox create'.
For more information, see the documentation.
⬢[core@toolbox tmp]$ sudo yum install -y wget
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Fedora 32 openh264 (From Cisco) - x86_64 903 B/s | 2.5 kB 00:02
Fedora Modular 32 - x86_64 1.1 MB/s | 4.9 MB 00:04
Fedora Modular 32 - x86_64 - Updates 1.3 MB/s | 3.7 MB 00:02
Fedora 32 - x86_64 - Updates 13 kB/s | 26 MB 33:42
Fedora 32 - x86_64 1.1 MB/s | 70 MB 01:01
Package wget-1.20.3-4.fc32.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
⬢[core@toolbox tmp]$ wget http://www.baidu.com
⬢[core@toolbox ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
fuse-overlayfs 3.1G 696M 2.2G 24% /
tmpfs 487M 0 487M 0% /sys/fs/cgroup
devtmpfs 448M 0 448M 0% /dev
tmpfs 487M 84K 487M 1% /dev/shm
tmpfs 98M 76K 98M 1% /etc/hostname
tmpfs 487M 6.8M 481M 2% /run/media
/dev/sda4 4.4G 1.9G 2.5G 43% /run/host/etc
tmpfs 487M 0 487M 0% /run/host/tmp
/dev/sda5 3.1G 696M 2.2G 24% /run/host/var
tmpfs 487M 0 487M 0% /tmp
⬢[core@toolbox ~]$ echo aaa > /run/host/tmp/test
⬢[core@toolbox ~]$ exit
logout
[core@tutorial ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 448M 0 448M 0% /dev
tmpfs 487M 84K 487M 1% /dev/shm
tmpfs 487M 6.8M 481M 2% /run
tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/sda4 4.4G 1.9G 2.5G 43% /sysroot
tmpfs 487M 0 487M 0% /tmp
/dev/sda5 3.1G 696M 2.2G 24% /var
/dev/sda1 364M 169M 173M 50% /boot
/dev/sda2 127M 8.5M 119M 7% /boot/efi
tmpfs 98M 68K 98M 1% /run/user/1000
[core@tutorial tmp]$ cat /tmp/test
aaa
https://www.katacoda.com/courses/coreos/playground