简体   繁体   English

试图让Docker运行,不断给我一个错误

[英]Trying to get docker to run, constantly gives me an error

I am trying to run docker with docker-compose up , but I continue to get this error. 我正在尝试使用docker-compose up运行docker,但是我继续收到此错误。

Removing storemagento_nginx_1
storemagento_redis_1 is up-to-date
storemagento_db_1 is up-to-date
storemagento_fpm_1 is up-to-date
Recreating f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_storemagento_nginx_1 ... 
Recreating f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_storemagento_nginx_1 ... error

ERROR: for f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_f751fff8304c_storemagento_nginx_1  Cannot start service nginx: driver failed programming external connectivity on endpoint storemagento_nginx_1 (7b1963dbb7e3b5ea97394dce65168d4a591301fb834c489aad52a9c2ea4e6eb7): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)

ERROR: for nginx  Cannot start service nginx: driver failed programming external connectivity on endpoint storemagento_nginx_1 (7b1963dbb7e3b5ea97394dce65168d4a591301fb834c489aad52a9c2ea4e6eb7): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)
ERROR: Encountered errors while bringing up the project.

This used to work fine, but then I installed an updated version of apache through brew and now this happens every time I switch back and forth. 过去可以正常工作,但是后来我通过brew安装了apache的更新版本,现在每次来回切换时都会发生这种情况。 I used to be able to try and kill all of the apache processes or restart and that seemed to work. 我曾经能够尝试杀死所有的apache进程或重新启动,但这似乎可行。 However now I can not get port 80 to free up. 但是,现在我无法释放80端口。 If I kill all processes running on port 80 apache will go away for a minute, but then return again. 如果我杀死了在端口80上运行的所有进程,apache将消失一分钟,然后再次返回。

So when I run 所以当我跑步

sudo lsof -i :80 | grep LISTEN
httpd   27987 root    4u  IPv6 0xcfcc888f0ccae989      0t0  TCP *:http (LISTEN)
httpd   27992 _www    4u  IPv6 0xcfcc888f0ccae989      0t0  TCP *:http (LISTEN)

These processes continue to return. 这些过程继续返回。 I was trying to create an alias that I could use to kill the processes correctly as below. 我试图创建一个别名,可以用来如下正确地杀死进程。 But I can not get this working in terminal. 但是我无法在终端上正常工作。

alias stopall-port80="sudo kill -9 $(sudo lsof -i :80 | grep LISTEN | egrep -v 'PID' | awk '{print $2}' | sort -n | uniq)"

If I take just the section sudo lsof -i :80 | grep LISTEN | egrep -v 'PID' | awk '{print $2}' | sort -n | uniq 如果我只看sudo lsof -i :80 | grep LISTEN | egrep -v 'PID' | awk '{print $2}' | sort -n | uniq sudo lsof -i :80 | grep LISTEN | egrep -v 'PID' | awk '{print $2}' | sort -n | uniq sudo lsof -i :80 | grep LISTEN | egrep -v 'PID' | awk '{print $2}' | sort -n | uniq and put it in the terminal it produces the correct PID's as expected. sudo lsof -i :80 | grep LISTEN | egrep -v 'PID' | awk '{print $2}' | sort -n | uniq并将其放在终端中,它将按预期生成正确的PID。 However when I try to run the alias stopall-port80 I get bash: 27057: command not found . 但是,当我尝试运行别名stopall-port80我得到bash: 27057: command not found

UPDATE UPDATE

This is working instead of using the alias 这正在工作,而不是使用别名

stopall_port80() {
    sudo kill -9 $(sudo lsof -i :80 | grep LISTEN | egrep -v 'PID' | awk '{print $2}' | sort -n | uniq);
}

Issue 1: Unwanted Apache Restarts 问题1:不需要的Apache重新启动

If the port frees up "for a minute" and then is in use again, you should tell the process supervision system that's starting the conflicting process to stop running that process . 如果端口释放了“一分钟”,然后又重新使用,则应告知正在启动冲突过程的过程监控系统停止运行该过程 In the case of Apache httpd on MacOS, that looks like: 如果是MacOS上的Apache httpd,则如下所示:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

Issue 2: Surprising alias expansion 问题2:令人惊讶的别名扩展

Your original code was -- on account of the use of double quotes -- building the list of httpd processes at the time when your alias was defined , not at the time when your alias was executed . 由于使用双引号,您的原始代码是在定义别名时而不是在执行别名时构建httpd进程的列表。 You could fix that by changing the quoting type, but the better answer is to use a function: 您可以通过更改引号类型来解决此问题,但是更好的答案是使用一个函数:

stopall_port80() { sudo kill $(...); }

...which will evaluate the $(...) when the function is run, not when it's set up in your .bashrc . ...它将在函数运行时评估$(...) ,而不是在.bashrc设置函数时进行评估。


Issue 3: Detecting PIDs Using A Port On MacOS 问题3:使用MacOS上的端口检测PID

sudo lsof -n -iTCP:80 | awk '/LISTEN/ { print $2 }'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 /bin/bash 给了我 docker 容器内的错误 - /bin/bash gives me the error inside docker container 在 docker 作曲家中执行 shell 命令给我错误 - executing shell command in docker composer gives me error 服务器在尝试scp时给我一个权限错误,但在ssh时却没有 - Server gives me a permission error when trying to scp, but not when ssh 尝试在Docker中运行Cloudera Image - Trying to run Cloudera Image in Docker Docker 在 `docker run 上给出`no such file or directory`<image_id> `</image_id> - Docker gives `no such file or directory` on `docker run <image_id>` Docker运行命令错误 - Docker run command error sed 在 macOS 中带有评论,它给了我一个错误 - sed with a comment in macOS, it gives me an error 在我在 bash 中运行的 python email 脚本中,在尝试运行它之后它给了我这个“'电子邮件'不是包”错误。 有任何想法吗? - In my python email script running in bash, after attempting to run it it gives me this “'email' is not a package” error. Any ideas? 尝试运行 Docker 映像时出现“exec 用户进程导致“没有这样的文件或目录”错误 - Getting "exec user process caused "no such file or directory"" error when trying to run Docker image 为什么试图杀死Docker容器中的进程使我无法参与其中? - Why does trying to kill a process in Docker container take me out of it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM