当前位置: 首页 > 知识库问答 >
问题:

AWS EC2无法执行脚本docker compose[重复]

冷英光
2023-03-14

我可以用sudo docker-comment up运行我的应用程序,但是当我只是做docker-composup时,我得到了

$ docker-compose up
Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 670, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1255, in request
  File "http/client.py", line 1301, in _send_request
  File "http/client.py", line 1250, in endheaders
  File "http/client.py", line 1010, in _send_output
  File "http/client.py", line 950, in send
  File "docker/transport/unixconn.py", line 43, in connect
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 439, in send
  File "urllib3/connectionpool.py", line 726, in urlopen
  File "urllib3/util/retry.py", line 410, in increment
  File "urllib3/packages/six.py", line 734, in reraise
  File "urllib3/connectionpool.py", line 670, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1255, in request
  File "http/client.py", line 1301, in _send_request
  File "http/client.py", line 1250, in endheaders
  File "http/client.py", line 1010, in _send_output
  File "http/client.py", line 950, in send
  File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker/api/client.py", line 214, in _retrieve_server_version
  File "docker/api/daemon.py", line 181, in version
  File "docker/utils/decorators.py", line 46, in inner
  File "docker/api/client.py", line 237, in _get
  File "requests/sessions.py", line 543, in get
  File "requests/sessions.py", line 530, in request
  File "requests/sessions.py", line 643, in send
  File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 80, in main
  File "compose/cli/main.py", line 189, in perform_command
  File "compose/cli/command.py", line 60, in project_from_options
  File "compose/cli/command.py", line 152, in get_project
  File "compose/cli/docker_client.py", line 41, in get_client
  File "compose/cli/docker_client.py", line 170, in docker_client
  File "docker/api/client.py", line 197, in __init__
  File "docker/api/client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', PermissionError(13, 'Permission denied'))
[48420] Failed to execute script docker-compose

这是我的Docker文件

FROM golang:alpine AS builder

ENV GO111MODULE=on
RUN mkdir /app
ADD . /app/
WORKDIR /app
COPY ./data.go .
COPY ./handlers.go .
COPY ./main.go .
COPY ./static /static
COPY ./ssl /ssl
COPY ./views /views
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(ls -1 *.go)
RUN useradd -u ubuntu
USER ubuntu
EXPOSE 3000
CMD ["go", "run", "."]

共有1个答案

朱和惬
2023-03-14

对于非root用户,需要将该用户添加到docker组。

1-创建一个docker组,如果不存在:

sudo groupadd docker

2-将您的用户添加到docker组:

sudo usermod -aG docker [non-root user]

3-注销并登录以刷新组成员资格。

 类似资料:
  • 我在尝试编译 eXo 平台时遇到麻烦。 错误消息是: < code >原因:java.io.IOException:无法运行程序“/exo/platform-public-distributions-develop/PLF-community-Tomcat-standalone/target/platform-community-5.0 . x-SNAPSHOT/platform-communit

  • 我试图将selenium test之一迁移到空手道,同时这样做我正在使用在留档中定义的script()方法,该方法在空手道中用于评估给定字符串为浏览器内的JavaScript,但我得到了这个 还分享我的功能文件,其中得到失败: 甚至我也试着在脚本中调用下面的语句,但仍然得到相同的错误 我正在使用gatling版本

  • 我有SunOs 5.10 unix服务器,在那里我编写了一个脚本来执行java文件,如下所示 在这个脚本中,有很多代码,其中包括日志文件,以及在导出JAVA HOME之前添加的其他二进制文件类路径。但当我执行时,我得到以下错误 我更改了很多java版本,但都出现了相同的错误

  • 我想在macos上使用apache2从PHP文件执行Python脚本。我能够执行简单的python脚本,如: 从PHP: 巨蟒 输出是: 但当我尝试导入以下包时: 我得到: 我的问题是,有人知道: 1–我如何使这些(以及任何其他)软件包工作? 2–shell_exec当前正在执行python2。如何添加Python 3?(如果我编写python3而不是python将无法工作)

  • 问题内容: 我有一个简单的PHP函数,该函数应在调用时执行Pyton脚本。我已经在我的php程序中多次尝试了这种功能,但是这次以某种方式该功能根本不执行python脚本。当我从命令提示符下访问脚本并运行时,它将成功执行。我要提到的一件事是,该脚本具有python的NLTK库的一些认真实现,并且执行和执行其操作(即数据处理并存储到db)需要20秒钟以上。执行延迟是否会导致此问题,或者这次我还缺少其他

  • 本文向大家介绍Shell脚本避免重复执行的方法,包括了Shell脚本避免重复执行的方法的使用技巧和注意事项,需要的朋友参考一下 很多用cron定时执行的shell脚本可能会由于各种原因执行很久,会有必要在运行的时候先检查一下自身是否还在运行。本文提供的linux shell脚本用以检查以命令sh ...来执行的shell脚本。要对其他东西进行唯一性检查,可以稍微修改一下源代码。