多年来,我已经进行了一些 Docker 测试,但是对于特定类型的测试,我需要的不仅仅是应用程序容器。所以我转向 LXC/LXD 容器,这很棒。安装 LXD 后,我创建了自己的容器:
>> willem@ubuntu:/$ lxc launch images:centos/7/amd64 thing Creating thing
Starting thing
>> willem@ubuntu:/$ lxc list
+-------+---------+------------------+------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+-------+---------+------------------+------+------------+-----------+
| thing | RUNNING | 10.0.3.30 (eth0) | | PERSISTENT | 0 |
+-------+---------+------------------+------+------------+-----------+
Run Code Online (Sandbox Code Playgroud)
伟大的。只有我似乎对这里的 IP 地址没有任何控制权。我找到了(在 Google 的帮助下并找到了)一个控制文件:
>> root@ubuntu:/# locate lxc.conf
/etc/init/lxc.conf
..
/var/log/lxd/thing/lxc.conf
Run Code Online (Sandbox Code Playgroud)
您可以在其中放置(看起来像)静态 IP4 地址。只有在重新启动容器时,主机似乎忘记了我的静态 IP,并从 DHCP 中获取了一个。问题:
--ip
开关docker run
)?我在 Perl 中运行 chown 函数时遇到问题。我有一个脚本:
#!/usr/bin/perl
$file = "";
$file = $ARGV[0];
$user = "jboss";
$group = "jboss";
if ($file eq "")
{
print "Syntax: $0 <file>\n";
exit 0;
}
@file = ($file);
print "Chowning the file $file to $user:$group\n";
$number = chown $user, $group, "$file";
print "Number of ownerships changed: $number\n";
exit 0;
Run Code Online (Sandbox Code Playgroud)
SELinux 已启用且允许,但是:
root# ls -l file
-rw-r--r--. 1 root root 0 Jul 26 10:27 file
root# id -a jboss uid=666(jboss) gid=666(jboss) groups=666(jboss)
root# perlchown_file.pl file
Chowning …
Run Code Online (Sandbox Code Playgroud)