我想使用此图像https://hub.docker.com/_/amazonlinux来编写我的 EC2 机器的脚本
\n\n这是我的文档:
\n\nFROM amazonlinux:2\n\nMAINTAINER "xxxxx" <xxxxx@xxxx.xx>\n\nRUN yum -y update\nRUN yum -y install httpd\n\nWORKDIR /var/www/html\n\nCMD [ "/usr/sbin/httpd","-D","FOREGROUND" ]\nRun Code Online (Sandbox Code Playgroud)\n\nsystemctl 不起作用:
\n\nbash-4.2# systemctl list-units\nFailed to get D-Bus connection: Operation not permitted\nRun Code Online (Sandbox Code Playgroud)\n\nbash-4.2# systemctl status httpd.service\nFailed to get D-Bus connection: Operation not permitted\nRun Code Online (Sandbox Code Playgroud)\n\n我无法重新启动
\n\nbash-4.2# systemctl restart httpd.service\nFailed to get D-Bus connection: Operation not permitted\nRun Code Online (Sandbox Code Playgroud)\n\n/etc/os-release
\n\nbash-4.2# cat /etc/os-release\nNAME="Amazon Linux"\nVERSION="2"\nID="amzn"\nID_LIKE="centos rhel fedora"\nVERSION_ID="2"\nPRETTY_NAME="Amazon Linux 2"\nANSI_COLOR="0;33"\nCPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"\nHOME_URL="https://amazonlinux.com/"\nRun Code Online (Sandbox Code Playgroud)\n\n在真正的 ec2 上没有问题:
\n\n[ec2-user@ip-xxxxxxxxx]$ …Run Code Online (Sandbox Code Playgroud)