前提、実現したいこと
Dockerコンテナを立ち上げ、Docker上でLaravelのトップページを表示させたいです。
エラー、問題点
docker-compose up -d nginx mysql workspace phpmyadmin で dockerコンテナを立ち上げようとしたら
laradock_docker-in-docker_1 is up-to-date laradock_mysql_1 is up-to-date Starting laradock_workspace_1 ... Starting laradock_phpmyadmin_1 ... error Starting laradock_workspace_1 ... error d: An attempt was made to access a socket in a way forbidden by its access permissions. ERROR: for laradock_workspace_1 Cannot start service workspace: Ports are not available: listen tcp 0.0.0.0:8001: bind: An attempt was made to access a socket in a way forbidden by its access permissions. ERROR: for phpmyadmin Cannot start service phpmyadmin: Ports are not available: listen tcp 0.0.0.0:8081: bind: An attempt was made to access a socket in a way forbidden by its access permissions. ERROR: for workspace Cannot start service workspace: Ports are not available: listen tcp 0.0.0.0:8001: bind: An attempt was made to access a socket in a way forbidden by its access permissions ERROR: Encountered errors while bringing up the project.
というようなエラーが出てポートの:8081が開いていないのかと思い、netstat -ano コマンドで確認してみましたが、
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1268 TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4 TCP 0.0.0.0:902 0.0.0.0:0 LISTENING 6316 TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 6316 TCP 0.0.0.0:2179 0.0.0.0:0 LISTENING 3004 TCP 0.0.0.0:2869 0.0.0.0:0 LISTENING 4 TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 21352 TCP 0.0.0.0:5040 0.0.0.0:0 LISTENING 420 TCP 0.0.0.0:5357 0.0.0.0:0 LISTENING 4 TCP 0.0.0.0:7680 0.0.0.0:0 LISTENING 4808 TCP 0.0.0.0:49664 0.0.0.0:0 LISTENING 932 TCP 0.0.0.0:49665 0.0.0.0:0 LISTENING 996 TCP 0.0.0.0:49666 0.0.0.0:0 LISTENING 2116 TCP 0.0.0.0:49667 0.0.0.0:0 LISTENING 2036 TCP 0.0.0.0:49668 0.0.0.0:0 LISTENING 5300 TCP 0.0.0.0:49672 0.0.0.0:0 LISTENING 664 TCP 127.0.0.1:3213 0.0.0.0:0 LISTENING 15572
といった具合に:8081番ポートが使用しているアプリが見当たりません。何が原因だと考えられるでしょうか...
その他試したこと
docker-compose ps を試したところ、このような結果が出ました。
Name Command State Ports --------------------------------------------------------------------------------------------------------- laradock_docker-in-docker_1 dockerd-entrypoint.sh Up 2375/tcp, 2376/tcp laradock_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp, 33060/tcp laradock_phpmyadmin_1 /docker-entrypoint.sh apac ... Exit 0 laradock_workspace_1 /sbin/my_init Exit 0
Dockerfileは以下のような内容でした。
# Install the base requirements for the app. # This stage is to support development. FROM python:alpine AS base WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt # Run tests to validate app FROM node:12-alpine AS app-base WORKDIR /app COPY app/package.json app/yarn.lock ./ RUN yarn install COPY app/spec ./spec COPY app/src ./src RUN yarn test # Clear out the node_modules and create the zip FROM app-base AS app-zip-creator RUN rm -rf node_modules && \ apk add zip && \ zip -r /app.zip /app # Dev-ready container - actual files will be mounted in FROM base AS dev CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] # Do the actual build of the mkdocs site FROM base AS build COPY . . RUN mkdocs build # Extract the static content from the build # and use a nginx image to serve the content FROM nginx:alpine COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip COPY --from=build /app/site /usr/share/nginx/html
開発環境
Windows10pro
Docker version 19.03.13
Laravel Framework 6.20.23
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/04/17 05:26 編集
2021/04/17 05:51
2021/04/17 16:46 編集