私は3つのDockerコンテナ(MongoDB、Express、Angular)上でMEANスタックアプリケーションを実行しています。私は角度のあるアプリに直ちに変更を加えたいと思っています。私はこのthreadに従うことを試みたが、角度のコンテナと、次のエラーを得た:MEANスタックアプリケーションをリロードするDocker-compose file err:そのようなファイルまたはディレクトリがありません
version: '3' # specify docker-compose version
# Define the services/containers to be run
services:
angular: # name of the first service
build: angular-srC# specify the directory of the Dockerfile
command: npm start
ports:
- "4200:4200" # specify port forewarding
- "49153:49153"
volumes:
- ./angular-src:/usr/src/app
express: #name of the second service
build: . # specify the directory of the Dockerfile
ports:
- "3000:3000" #specify ports forewarding
links:
- mongodb # link this service to the database service
mongodb: # name of the third service
image: mongo
command: mongod --smallfiles
ports:
- 27017 # specify port forewarding
mongo_seed:
build: ./mongo_seed
links:
- mongodb
と角のアプリのための私のドッキングウィンドウのファイル:
ここno such file or directory, open '/usr/src/app/package.json'
は私のドッキングウィンドウ・コンポーズファイルであります
# Create image based on the official Node 6 image from dockerhub
FROM node:8.9.1
# Create a directory where our app will be placed
RUN mkdir -p /usr/src/app
# Change directory so that our commands run inside this new directory
WORKDIR /usr/src/app
# Copy dependency definitions
COPY package.json /usr/src/app
# Install dependecies
RUN npm install
# Get all the code needed to run the app
COPY . /usr/src/app
# Expose the port the app runs in
EXPOSE 4200 49153
# Serve the app
CMD ["npm", "start"]
ありがとうございます。ボリュームがマウントされた後、あなたはコンテンツが 'angular-src'のすべてであると言いました。これはpackage.jsonも正しいはずですか?私が完全に理解しているかどうかわからない... – Batmax
あなたのホストに./angular-src/package.jsonが存在すれば、はい。そうでなければ、いいえ。コンテナ 'docker run -it/bin/bash'を見て、/ usr/src/appの内容を確認してください。 okだと思ったら、 'docker run -it -v $(pwd)/ angular-src:/ usr/src/app /bin/bash'という構成からボリュームマウントを模倣して、再度確認してください物事はあなたが期待しているとおりです。 –
bluescores