退会済みユーザー
2018/10/02 15:35 投稿
Dockerコンテナ内でのviの挙動がおかしい |
DockerでシンプルにApacheをインストールしたコンテナを作成しました。 |
```DockerFile |
FROM centos |
LABEL title="TestApacheImage"\ |
version="1.0"\ |
description="test apache" |
RUN ["rpm", "--import", "/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7"] |
RUN ["yum", "-y", "install","httpd"] |
EXPOSE 80 |
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] |
``` |
これを以下のコマンドで起動します。 |
```ここに言語を入力 |
#ビルド |
docker image build -t apache -f DockerFile . |
#run(viで開いたとき変な折り返しをしていたので環境変数いじってます) |
docker container run -it -p 8080:80 -e COLUMNS=$COLUMNS -e LINES=$LINES -e TERM=$TERM apach |
``` |
するとこのようなエラーが出たので |
``` |
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message |
``` |
ServerNameを編集するために、`/etc/httpd/conf/httpd.conf` をviで開いてみました。 |
```httpd.conf |
# |
# This is the main Apache HTTP server configuration file. It contains the |
# configuration directives that give the server its instructions. |
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. |
# In particular, see |
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> |
# for a discussion of each configuration directive. |
# |
# Do NOT simply read the instructions in here without understanding |
# what they do. They're here only as hints or reminders. If you are unsure |
# consult the online docs. You have been warned. |
# |
# Configuration and logfile names: If the filenames you specify for many |
# of the server's control files begin with "/" (or "drive:/" for Win32), the |
# server will use that explicit path. If the filenames do *not* begin |
# with "/", the value of ServerRoot is prepended -- so 'log/access_log' |
# with ServerRoot set to '/www' will be interpreted by the |
# server as '/www/log/access_log', where as '/log/access_log' will be |
# interpreted as '/log/access_log'. |
# |
# ServerRoot: The top of the directory tree under which the server's |
# configuration, error, and log files are kept. |
# |
# Do not add a slash at the end of the directory path. If you point |
# ServerRoot at a non-local disk, be sure to specify a local disk on the |
# Mutex directive, if file-based mutexes are used. If you wish to share the |
# same ServerRoot for multiple httpd daemons, you will need to change at |
# least PidFile. |
# |
ServerRoot "/etc/httpd" |
# |
# Listen: Allows you to bind Apache to specific IP addresses and/or |
# ports, instead of the default. See also the <VirtualHost> |
# directive. |
# |
# Change this to Listen on specific IP addresses as shown below to |
# prevent Apache from glomming onto all bound IP addresses. |
# |
"/etc/httpd/conf/httpd.conf" 353L, 11753C |
``` |
するとこのように表示されたのですが、これより先がまったく表示されません。本来この下にServerNameの設定する部分があったと思うのですが、なぜ表示されないのでしょうか? |
するとこのように表示されたのですが、これより先がまったく表示されません。本来この下にServerNameの設定する部分があったと思うのですが、なぜ表示されないのでしょうか? |
【追記】 |
ちなみにDockerはVagrantで立ち上げたLinuxで行っています。git bushで `vagrant ssh` しているのですが、その辺も関係あるのでしょうか・・ |