我用httpd
映像创建了一个docker容器:
sudo docker run -dt -p 8080:80 httpd
我通过输入以下内容验证了它是否有效:http://localhost:8080
我在容器内打开了外壳:
docker exec -it <container_id> bash
我更改了默认网页的内容(index.html
(,该内容位于:
/usr/local/apache2/htdocs/index.html
我想看到新的更改,但是当我刷新页面时没有任何反应。
我重新启动了容器,它仍然显示默认网页。
我正在尝试在容器的外壳中重新启动httpd
服务,但没有成功,这就是我尝试的(基于此(:
# sudo service apache2 restart
apache2: unrecognized service
# service httpd restart
httpd: unrecognized service
# systemctl start apache2.service
Failed to get D-Bus connection: Unknown error -1
# /etc/init.d/apache2 reload
bash: /etc/init.d/apache2: No such file or directory
这是FireFox的缓存问题。
我在隐私浏览中打开了它,它起作用了。
验证它的一个好方法是运行:
curl http://localhost:8080
我将返回更新的 GET 请求。