nuxt.jsプロジェクトでコンテナを起こしてドメインを叩いて接続できるか試したのですが、うまくいきません。
こちらがDockerFile
//DockerFile FROM amazonlinux:2 LABEL maintainer yo RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm RUN rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm RUN yum update -y RUN yum install -y \ initscripts \ sudo \ git \ zip \ unzip \ tar \ httpd \ wget \ less \ libxslt \ automake \ autoconf \ mysql \ libmcrypt \ libtool-ltdl \ gcc gcc-c++ \ which \ vim \ socket.io RUN amazon-linux-extras install php7.2 nginx1.12 RUN touch /etc/sysconfig/network # nvm node npm install RUN git clone git://github.com/creationix/nvm.git ~/.nvm RUN echo 'export NVM_DIR="$HOME/.nvm"' > ~/.bashrc RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> ~/.bashrc RUN . ~/.nvm/nvm.sh &&\ nvm install v10.1.0 &&\ nvm use v10.1.0 &&\ nvm alias default v10.1.0 # yarn install RUN wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - RUN yum install -y yarn RUN yarn global add @vue/cli RUN yarn global add @vue/cli-init # sets localtime RUN cp /etc/localtime /etc/localtime.org RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime # RUN export LANG=en_US.UTF-8 ENV LANG en_US.UTF-8 RUN rm -f /etc/nginx/default.d/php.conf RUN chown -R root:nginx /var/log/nginx RUN chmod -R 770 /var/log/nginx/ RUN usermod -aG root nginx RUN useradd docker
こちらがcomposeファイル
//docker-compose.yml version: '3.6' services: pulan: build: context: ./pulan/ dockerfile: Dockerfile container_name: "pulan" command: "/sbin/init" volumes: - ./nginx/conf.d:/etc/nginx/conf.d/ - ./env/.bashrc:/root/.bashrc - ../../pulan-view:/var/www/pulan tty: true expose: - 80 ports: - 3000:3000 privileged: true environment: VIRTUAL_HOST: local.p.tools networks: default: external: name: common_link
nuxtプロジェクトのファイル構成は以下になっています。
app ┣ pages/login ー index.vue ┣ index.js nuxt.config.js package.json yarn.lock
リバースプロキシのcommon_link
製作時のコマンド
docker network create --driver bridge common_link subnet=172.0.0/24
/etc/hosts内
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 local.p.tools ~ ~ ~ "/etc/hosts" 12L, 311C
製作したコンテナIP
bash-4.2# ip route default via 172.18.0.1 dev eth0 172.18.0.0/24 dev eth0 proto kernel scope link src 172.18.0.6
別コンテナからドメイン叩いてみるとレスポンスが返ってくるので、ネットワークの方に問題があるのかと思われます。
他に確認したい情報などありましたら修正欄でコメントしてください。
あなたの回答
tips
プレビュー