在docker-compose up后,无法执行容器中的命令,找不到容器内组件的环境变量

docker-compose.yml文件内容如下
cassandra:
image: cassandra:3.7
ports:

  • "7000:7000"
  • "7001:7001"
  • "7199:7199"
  • "9042:9042"
  • "9160:9160"
    zookeeper:
    image: wurstmeister/zookeeper
    ports:

    • "2181:2181" kafka: image: wurstmeister/kafka ports:
    • "9092:9092" links:
    • zookeeper:zk environment: KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1 volumes:
    • /var/run/docker.sock:/var/run/docker.sock

      在运行docker-compose up,三个容器启动后,老同事的电脑可以直接执行kafka,cassandra等组件的命令如kafka-topics.sh,
      在我的电脑上却不行,效果就好比这三个组件的环境变量没有export到本身系统中,请问如何解决?

      谢谢!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Beego-使用docker-compose实施中的端口号,而不是使用app.conf中的端口号

<div class="post-text" itemprop="text"> <p>I am trying to run the beego application using docker with the help of docker-compose. I am able access the demo application in <a href="http://localhost:8081" rel="nofollow noreferrer">http://localhost:8081</a> URL after running <code>docker-compose up</code>.</p> <p><strong>docker-compose.yml</strong></p> <pre><code>version: "2" services: app: build: . volumes: - .:/go/src/hello ports: - "8080:8080" working_dir: /go/src/hello command: bee run </code></pre> <p><strong>Dockerfile</strong></p> <pre><code>FROM golang:1.10 ## Install beego and the bee dev tool RUN go get github.com/astaxie/beego &amp;&amp; go get github.com/beego/bee </code></pre> <p><strong>app.conf</strong> from beego framework</p> <pre><code>appname = hello httpport = 8081 runmode = dev </code></pre> <p>How can I overwrite the <code>httpport</code>(8081) in <code>app.conf</code> using <code>ports</code>(8080) number used in <code>app</code> from <code>docker-compose.yml</code>. After running <code>docker-compose up</code> application runs in port 8081 not in 8080. How can I solve this?</p> </div>

授予php-fpm容器在docker-compose中写入文件的权限

<div class="post-text" itemprop="text"> <p>How can i give permission to php-fpm container to write files to a directory?</p> <p>docker-compose.yml file :</p> <pre><code>version: '3' services: web: image: nginx:latest ports: - "8080:80" volumes: - ./code:/code - ./site.conf:/etc/nginx/conf.d/default.conf - ./logs:/var/log/nginx restart: always depends_on: - php php: image: bitnami/php-fpm:7.1 volumes: - ./custom.ini:/opt/bitnami/php/etc/conf.d/custom.ini - ./code:/code db: image: postgres:10.1 restart: always environment: - POSTGRES_DB=${DB_NAME} - POSTGRES_USER=${DB_USER} - POSTGRES_PASSWORD=${DB_PASSWORD} ports: - 5400:5432 </code></pre> <p>When docker-compose is up I try to run my code but I get an error that says php doesn't have permission to write files:</p> <pre><code>PHP message: PHP Warning: mkdir(): Permission denied in /code/vendor/yiisoft/yii2/helpers/BaseFileHelper.php on line 624" while reading upstream, client: 10.0.2.2, server: , request: "GET / HTTP/$ 2018/11/24 09:35:25 [error] 6#6: *2 FastCGI sent in stderr: "PHP message: An Error occurred while handling another error: yii\base\InvalidConfigException: The directory is not writable by the Web process: /code/assets/runtime in /code/vendor/yiisoft/yii2/web/AssetManager.php:215 </code></pre> </div>

尝试在运行docker-toolbox的Windows上使用docker-compose在docker容器内运行webpack-dev-server时出现“服务器的空响应”

<div class="post-text" itemprop="text"> <p>I am having problems accessing a react container run with docker-compose inside docker-machine. I can curl the webpage inside the container, but I cannot access it inside docker-machine (or on the host's browser for that matter). The backend Golang container can be accessed from docker-machine and from the host's browser (as seen in the snippets, it returns a <em>404 not found</em>).</p> <p>In the docker-compose logs everything seems to be running smoothly, webpack-dev-server runs as expected, I just can't access it from outside the container.</p> <p>I am using docker toolbox for windows.</p> <p>Best to additionally describe the problem with some snippets.</p> <p><strong>Docker-compose file:</strong></p> <pre><code>version: '2' services: postgres: image: postgres environment: - POSTGRES_PASSWORD=postgres server: build: ./server command: gin volumes: - ./server:/go/src/app ports: - "8080:3000" environment: - POSTGRES_PASSWORD=postgres client: build: ./client command: npm start volumes: - ./client:/usr/src/app # mount node_modules as a workaround for it disappearing # after adding /client as a mounted folder - /usr/src/app/node_modules ports: - "9000:3000" </code></pre> <p><strong>Dockerfile for the node container:</strong></p> <pre><code>FROM node:6.5.0-slim RUN mkdir -p /usr/src/app WORKDIR /usr/src/app COPY package.json /usr/src/app/ ENV NODE_ENV development RUN npm install </code></pre> <p><strong>Output of the following commands inside docker-machine (default):</strong></p> <blockquote> <p>docker@default:~$ sudo iptables -t nat -L -n</p> </blockquote> <pre><code>Chain PREROUTING (policy ACCEPT) target prot opt source destination DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination DOCKER all -- 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 172.17.0.0/16 0.0.0.0/0 MASQUERADE all -- 172.19.0.0/16 0.0.0.0/0 MASQUERADE all -- 172.18.0.0/16 0.0.0.0/0 MASQUERADE tcp -- 172.19.0.2 172.19.0.2 tcp dpt:3000 MASQUERADE tcp -- 172.19.0.3 172.19.0.3 tcp dpt:3000 Chain DOCKER (2 references) target prot opt source destination RETURN all -- 0.0.0.0/0 0.0.0.0/0 RETURN all -- 0.0.0.0/0 0.0.0.0/0 RETURN all -- 0.0.0.0/0 0.0.0.0/0 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 to:172.19.0.2:3000 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9000 to:172.19.0.3:3000 </code></pre> <p><em>Here comes the main problem:</em></p> <blockquote> <p>docker@default:~$ curl 0.0.0.0:9000</p> </blockquote> <pre><code>curl: (52) Empty reply from server </code></pre> <blockquote> <p>docker@default:~$ curl 0.0.0.0:8080</p> </blockquote> <pre><code>404 page not found </code></pre> <blockquote> <p>docker@default:~$ docker ps</p> </blockquote> <pre><code>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f93fd1833de2 goreacttodo_client "npm start" 32 minutes ago Up 5 minutes 0.0.0.0:9000-&gt; 3000/tcp goreacttodo_client_1 ff1fa9c33b05 postgres "/docker-entrypoint.s" 3 days ago Up 5 minutes 5432/tcp goreacttodo_postgres_1 e4581f8e368b goreacttodo_server "gin" 3 days ago Up 5 minutes 0.0.0.0:8080-&gt; 3000/tcp goreacttodo_server_1 </code></pre> <p>Output of the following commands inside the node container:</p> <blockquote> <p>root@f93fd1833de2:/usr/src/app# curl localhost:3000</p> </blockquote> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body lang="en"&gt; &lt;div id="react-app"&gt;&lt;/div&gt; &lt;script src="/bundle.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/body&gt;&lt;/html&gt; </code></pre> <p>Any help would be greatly appreaciated.</p> </div>

Docker-Compose API调用和端点容器化

<div class="post-text" itemprop="text"> <p>Using docker-compose I've got multiple containers running - one of them is the profiler container that calls an API, the other container apiconnection should be receiving the call and sending information back. However when I run the compose file it always returns <code>Get http://apiconnection:8080/maccaption: dial tcp: lookup apiconnection on 127.0.0.11:53: no such host</code> on the Profiler container at the <code>http.DefaultClient.Do</code> line.</p> <p>This is a sample of my compose file: </p> <pre><code>apiConnection: image: apiconnection:1.0 ports: - "8080:8080" networks: - maccaptionNet profiler: image: profiler:1.0 networks: - maccaptionNet depends_on: - "apiConnection" </code></pre> <p>I'm calling the api in my profiler image like so - it's erroring on <code>DefaultClient</code>: </p> <pre><code>url := "http://apiconnection:8080/maccaption" req, err := http.NewRequest("GET", url, nil) if err != nil { log.Fatal(err) } res, err := http.DefaultClient.Do(req) if err != nil { fmt.Println("Line 27") log.Fatal(err) } body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println("Line 33") log.Fatal(err) } </code></pre> <p>If I modify the <code>url := "http://apiconnection:8080/maccaption"</code> to look at localhost like this <code>url := "http://localhost:8080/maccaption"</code> it changes to <code>connect refused</code>, but I don't think I should be looking at localhost, I need to look at the Docker container don't I? </p> <p>I'm setting the url as a connection to the docker container and using the ports I've assigned in the docker-compose file. and receiving the request in my apiconnection image like this: </p> <pre><code> r := mux.NewRouter() r.HandleFunc("/maccaption", handleMaccaption).Methods("GET") http.ListenAndServe(":8080", r) </code></pre> <p>All it should be doing now is starting up and making a single request to prove that it is working and returning some json information. This code works outside of docker, replacing the container name in the url variable with localhost. But I cannot get it running within docker. </p> <p>I've looked at these other sources for assistance but to no avail: <a href="https://stackoverflow.com/questions/53304923/how-to-call-api-endpoint-inside-docker-container">how to call api endpoint inside docker container?</a> <a href="https://stackoverflow.com/questions/44784666/making-a-rest-call-to-endpoint-in-dockers">Making a REST Call to Endpoint in Dockers</a> <a href="https://stackoverflow.com/questions/38880615/docker-compose-internal-communication-using-endpoints">Docker-compose internal communication using endpoints</a></p> <p>Any pointers would be greatly appreciated - thank you! </p> <p>**EDIT - to fix my wonky code formatting</p> </div>

拒绝连接:使用docker-compose从应用容器访问Postgres容器

<div class="post-text" itemprop="text"> <p>I'm new to Docker. This project is just for my own understanding. It's likely that I use incorrect terminology and/or am more confused than I think I am. Corrections are gratefully accepted.</p> <p>I'm using two docker images: the official postgres image and my own Go app and Dockerfile. Using <code>docker-compose up</code> I get the <code>connection refused</code> error.</p> <p>I think that there are potentially two different problems: </p> <ul> <li><p>One, the database is not running when the app is trying to connect. </p></li> <li><p>Two, the app is simply using an invalid IP.</p></li> </ul> <p>I have app code that should be giving the database time to start up to address the first potential problem (see code below). Judging by the error message, I don't think I'm even getting that far.</p> <p>I have two services: db-access (that's the Go app) and postgres-db.</p> <p>I have tried using these host names in the app connection string: </p> <ul> <li><p>"localhost", </p></li> <li><p>"postgres-db" (as it's named in the docker-compose.yml), </p></li> <li><p>"0.0.0.0".</p></li> </ul> <p>Using the <code>postgres-db</code> as the hostname:</p> <ul> <li><p>The app container is trying: dial tcp 172.22.0.2:5432.</p></li> <li><p>Postgres is saying: listening on IPv4 address "0.0.0.0", port 5432.</p></li> </ul> <p>In the <code>docker-compose.yml</code> I have tried using these statements: </p> <pre><code>depends_on: - postgres-db </code></pre> <p>and</p> <pre><code>links: - postgres-db </code></pre> <p>I have tried reversing the order of the services in the docker-compose.yml but they appear to start up in the same order either way.</p> <p>When I run the postgres container and the Go app separately I get the expected behavior. To run them separately I'm using these commands:</p> <pre><code>docker run --rm --name postgres-db -e POSTGRES_PASSWORD=docker -d -p 5432:5432 -v /Users/ForeignFood/Development/go/src/github.com/skillitzimberg/docker/volumes/postgres:/var/lib/postgresql/data postgres </code></pre> <p>followed by</p> <p><code>go run basicapi</code></p> <p>I can also run <code>docker-compose up</code>, which gives the connection refused error, then <code>ctrl+C</code>, then run <code>go run basicapi</code> and get the expected behavior.</p> <p>Here are the project files . . .</p> <p>main.go:</p> <pre><code>package main import ( "basicapi/models" "fmt" "net/http" _ "github.com/lib/pq" ) const ( host = "postgres-db" port = 5432 user = "postgres" password = "docker" dbname = "myfirstdb" ) var psqlDatabaseConnectionString = fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", host, port, user, password, dbname) func main() { models.InitDB(psqlDatabaseConnectionString) http.HandleFunc("/users", usersList) http.ListenAndServe(":3000", nil) } func usersList(w http.ResponseWriter, r *http.Request) { if r.Method != "GET" { http.Error(w, http.StatusText(405), 405) return } usrs, err := models.AllUsers() if err != nil { fmt.Println(err) http.Error(w, http.StatusText(500), 500) return } for _, usr := range usrs { fmt.Fprintf(w, "%d, %s, %s, %.s ", usr.ID, usr.FirstName, usr.LastName, usr.Email) } } </code></pre> <p>models/db.go:</p> <pre><code>package models import ( "database/sql" "fmt" "log" "time" _ "github.com/lib/pq" ) var db *sql.DB func InitDB(dataSourceName string) { var err error for i := 0; i &lt; 10; i++ { db, err = sql.Open("postgres", dataSourceName) if err != nil { fmt.Println(i) fmt.Println(err) time.Sleep(time.Second * 10) } } if err != nil { log.Panic(err) } if err = db.Ping(); err != nil { log.Panic(err) } fmt.Printf("Connection to database successful! ") } </code></pre> <p>models/users.go:</p> <pre><code>package models import "fmt" type User struct { ID int Age int FirstName string LastName string Email string } func AllUsers() ([]*User, error) { fmt.Println("Got to AllUsers") rows, err := db.Query("SELECT * FROM users") if err != nil { fmt.Println(err) return nil, err } defer rows.Close() users := make([]*User, 0) for rows.Next() { user := new(User) err := rows.Scan(&amp;user.ID, &amp;user.Age, &amp;user.FirstName, &amp;user.LastName, &amp;user.Email) if err != nil { return nil, err } users = append(users, user) } if err = rows.Err(); err != nil { return nil, err } return users, nil } </code></pre> <p>Dockerfile:</p> <pre><code>FROM golang WORKDIR /app COPY ./go.mod ./go.mod COPY ./go.sum ./go.sum RUN go mod download COPY . . RUN go build -o /bin/app CMD [ "app" ] </code></pre> <p>docker-compose.yml</p> <pre><code>services: db-access: build: . depends_on: - postgres-db ports: - "3000:3000" postgres-db: image: postgres volumes: - /Users/ForeignFood/Development/go/src/github.com/skillitzimberg/docker/volumes/postgres:/var/lib/postgresql/data ports: - "5432:5432" environment: POSTGRES_USER: "postgres" POSTGRES_PASSWORD: "docker" POSTGRES_DATABASE: "myfirstdb" </code></pre> <p>Expected results: Navigating to localhost:3000/users shows:</p> <pre><code>1, Someone, Alastname, 2, SomeoneElse, AnotherLastName, etc... </code></pre> <p>Actual results:</p> <ul> <li><p>browser: <code>This site can't be reached</code></p></li> <li><p>terminal: </p></li> </ul> <pre><code>~/ &gt;&gt; docker-compose up Starting basicapi_postgres-db_1 ... done Starting basicapi_db-access_1 ... done Attaching to basicapi_postgres-db_1, basicapi_db-access_1 db-access_1 | 2019/05/17 16:53:54 dial tcp 172.22.0.2:5432: connect: connection refused db-access_1 | panic: dial tcp 172.22.0.2:5432: connect: connection refused db-access_1 | db-access_1 | goroutine 1 [running]: db-access_1 | log.Panic(0xc0000c3f40, 0x1, 0x1) db-access_1 | /usr/local/go/src/log/log.go:333 +0xac db-access_1 | basicapi/models.InitDB(0xc000062120, 0x55) db-access_1 | /app/models/db.go:30 +0x27c db-access_1 | main.main() db-access_1 | /app/main.go:23 +0x3d basicapi_db-access_1 exited with code 2 postgres-db_1 | 2019-05-17 16:53:58.770 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres-db_1 | 2019-05-17 16:53:58.770 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgres-db_1 | 2019-05-17 16:53:58.776 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres-db_1 | 2019-05-17 16:53:58.905 UTC [22] LOG: database system was shut down at 2019-05-17 16:53:23 UTC postgres-db_1 | 2019-05-17 16:53:58.952 UTC [1] LOG: database system is ready to accept connections </code></pre> <p>Thank you for any insights.</p> </div>

尝试使用docker compose文件连接Redis时连接被拒绝

<div class="post-text" itemprop="text"> <p>我在尝试使用redis-golang驱动程序连接到Redis时遇到问题。 这是我的 <code>docker-compose.yml</code>文件 : </p> <pre><code>version: "3" services: driver: build: ./API-Golang command: go run app.go volumes: - ./API-Golang:/app ports: - "8080:8080" depends_on: - db - redis links : - redis - db redis: image: redis container_name: redis ports: ["6379:6379"] db: image: mongo:3.4.2 container_name: mongodb ports : ["27017:27017"] </code></pre> <p>这是我试图连接到redis (API-Golang/数据库/allSystem.go)的代码:</p> <pre><code>redisConn := RedisHost{ Address: "localhost:6379", Password: "", DB: 0, } redisConnection, err := redisConn.Connect() if err != nil { panic(err) } </code></pre> <p>我试图改变 <code>localhost</code>为 <code>redis</code> 但它还是不管用。错误如下:</p> <pre><code>driver_1 | panic: dial tcp [::1]:6379: getsockopt: connection refused driver_1 | driver_1 | goroutine 1 [running]: driver_1 | github.com/Gujarats/API-Golang/database.SystemConnection(0x48) driver_1 | /go/src/github.com/Gujarats/API-Golang/database/allSystem.go:32 +0x3d3 driver_1 | main.main() driver_1 | /go/src/github.com/Gujarats/API-Golang/app.go:24 +0x34 driver_1 | exit status 2 </code></pre> <p>你知道哪里出错了吗?</p> <p><a href="https://github.com/Gujarats/Go-docker" rel="nofollow noreferrer">源代码</a></p> </div>

Docker - ENTRYPOINT脚本导致重新启动

<div class="post-text" itemprop="text"> <p>I'm relatively new to Docker - I'm trying to build a system to run a Symfony 4 app, comprising of PHP-FPM, nginx and MySQL. </p> <p>Everything works as it should except one thing. When the PHP-FPM container boots, I want to run: </p> <pre><code>#!/bin/bash composer install bin/console doctrine:database:create --if-not-exists bin/console doctrine:schema:update --force bin/console doctrine:fixtures:load --no-interaction </code></pre> <p>I created a script with these commands in and then edited my DockerFile as follows: </p> <pre><code>COPY ./docker/php/startup.sh /usr/local/bin/startup.sh RUN ["chmod", "+x", "/usr/local/bin/startup.sh"] ENTRYPOINT ["/usr/local/bin/startup.sh"] </code></pre> <p>The issue I'm having is that when I run <code>docker-compose build</code> and then <code>docker-compose up</code>, I can see the script runs, but something in it causes the container to fail and restart itself - the script then runs again, and the cycle continues. The docker-compose.yml has <code>restart: unless-stopped</code> specified by the way.</p> <p>I wondered if one of the commands was exiting with a non zero code, so tried to add <code>exit 0</code> to the end of the script, but to no avail. </p> <p>Am I doing something daft? To be clear, I want this script to run automatically on the first boot of the container (it's fine if it runs every boot for what it's worth, not just <em>the very first</em> time). </p> </div>

如何在docker compose的帮助下正确设置golang应用程序的第三方库?

<div class="post-text" itemprop="text"> <p>I am trying to deploy my <strong>Golang</strong> application with the help of docker compose.</p> <p>In CentOS server the hierarchy of folders:</p> <pre><code>docker_app - src - app - docker-compose.yml - main.go </code></pre> <p>This Golang application use several third-party libraries:</p> <ul> <li><p>Gorilla Mux;</p></li> <li><p>Gorilla Handlers;</p></li> <li><p>pq;</p></li> <li><p>godotenv;</p></li> <li><p>GORM;</p></li> <li><p>goracle.</p></li> </ul> <p><strong>docker-compose.yml</strong>:</p> <pre><code>version: '2' services: app: image: golang:1.11-alpine volumes: - .:/go/src/app working_dir: /go/src/app command: go run main.go </code></pre> <p>When I try to run <code>docker-compose up</code> project it raise error:</p> <pre><code>Attaching to app_app_1 app_1 | main.go:4:2: cannot find package "github.com/gorilla/handlers" in any of: app_1 | /usr/local/go/src/github.com/gorilla/handlers (from $GOROOT) app_1 | /go/src/github.com/gorilla/handlers (from $GOPATH) </code></pre> <p>As you can see I need to set up third-party libraries. How to make it correctly? Also how to set up the name of the future docker image and contaiener with the help of docker compose?</p> <p>Is it possible to create <code>go.mod</code> file on <code>Windows 10</code>?</p> <p>When I run <code>$Env:GOOS = "linux"; $Env:GOARCH = "amd64"; go build</code> command in Powershell it raise error:</p> <p><a href="https://i.stack.imgur.com/NfH5c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NfH5c.png" alt="enter image description here"></a></p> </div>

docker nginx 502坏网关

<div class="post-text" itemprop="text"> <p>I was trying to change the port number in both nginx.conf and docker-compose.yml to 9001 instead 9000. However, when I run docker-compose up, it shows 502 Bad Gateway. Why is that? am I locked to use port 9000 only? </p> <p><strong>nginx.conf</strong></p> <pre><code>location /index.php { include fastcgi_params; fastcgi_connect_timeout 10s; fastcgi_read_timeout 10s; fastcgi_buffers 256 4k; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass php:9000; &lt;-- Changing this to 9001 } </code></pre> <p><strong>docker-compose.yml</strong></p> <pre><code>php: build: images/php volumes: - ./images/php/app:/app working_dir: /app/public command: php-fpm links: - db - cache ports: - "9000:9000" &lt;-- Changing this to "9001:9001" </code></pre> </div>

Hyperledger Fabric 在 chaincode-docker-devmode 中為何加入CouchDB容器,會導致Cli容器無法啟動?

因为目前还在初学阶段,所以选择fabric-simple 中的开发者模式来测试chaincode,但当我在docker-compose-simple.yaml 中加入 CouchDB容器,如下: ``` version: '2' services: orderer: container_name: orderer image: hyperledger/fabric-orderer environment: - FABRIC_LOGGING_SPEC=debug - ORDERER_GENERAL_LISTENADDRESS=orderer - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISFILE=orderer.block - ORDERER_GENERAL_LOCALMSPID=DEFAULT - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp - GRPC_TRACE=all=true, - GRPC_VERBOSITY=debug working_dir: /opt/gopath/src/github.com/hyperledger/fabric command: orderer volumes: - ./msp:/etc/hyperledger/msp - ./orderer.block:/etc/hyperledger/fabric/orderer.block ports: - 7050:7050 couchdb: container_name: couchdb image: hyperledger/fabric-couchdb environment: - COUCHDB_USER= - COUCHDB_PASSWORD= ports: - 5984:5984 peer: container_name: peer image: hyperledger/fabric-peer dns_search: . environment: - CORE_PEER_ID=peer - CORE_PEER_ADDRESS=peer:7051 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer:7051 - CORE_PEER_LOCALMSPID=DEFAULT - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - FABRIC_LOGGING_SPEC=DEBUG - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984 - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME= - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD= volumes: - /var/run/:/host/var/run/ - ./msp:/etc/hyperledger/msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer command: peer node start --peer-chaincodedev=true ports: - 7051:7051 - 7053:7053 depends_on: - orderer - couchdb cli: container_name: cli image: hyperledger/fabric-tools tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - FABRIC_LOGGING_SPEC=DEBUG - CORE_PEER_ID=cli - CORE_PEER_ADDRESS=peer:7051 - CORE_PEER_LOCALMSPID=DEFAULT - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp working_dir: /opt/gopath/src/chaincodedev command: /bin/bash -c './script.sh ; sleep 20' volumes: - /var/run/:/host/var/run/ - ./msp:/etc/hyperledger/msp - ./../chaincode:/opt/gopath/src/chaincodedev/chaincode - ./:/opt/gopath/src/chaincodedev/ depends_on: - orderer - peer chaincode: container_name: chaincode image: hyperledger/fabric-ccenv tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - FABRIC_LOGGING_SPEC=DEBUG - CORE_PEER_ID=example02 - CORE_PEER_ADDRESS=peer:7051 - CORE_PEER_LOCALMSPID=DEFAULT - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp working_dir: /opt/gopath/src/chaincode command: /bin/bash -c 'sleep 6000000' volumes: - /var/run/:/host/var/run/ - ./msp:/etc/hyperledger/msp - ./../chaincode:/opt/gopath/src/chaincode depends_on: - orderer - peer ``` 当我使用以下指令启动容器, ``` docker-compose -f docker-compose-simple.yaml up ``` 唯有Cli 容器是无法启动的状态,并在Logs中返回以下错误讯息 ``` Error: error getting endorser client for channel: endorser client failed to connect to peer:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 172.29.0.4:7051: connect: connection refused" ``` 有查询到同样错误讯息的人是在docker 启动设定档加入sleep指令,加长等待时间以确定CouchDB启动 ``` command: /bin/bash -c 'sleep 6000000' ``` 但我即使加入了,还是会报相同的错误

在docker容器中运行时,golang项目找不到依赖项

<div class="post-text" itemprop="text"> <p>I have this golang sandbox project: <a href="https://github.com/cflynn07/golang-db-gateway-example" rel="nofollow">https://github.com/cflynn07/golang-db-gateway-example</a></p> <p>When I try to run <code>gateway/gateway.go</code> inside a <code>golang:1.6.0-alpine</code></p> <pre><code>~/g/s/g/c/golang-db-gateway-example git:master ❯❯❯ docker-compose up gateway mysql_server is up-to-date Starting gateway Attaching to gateway gateway | gateway.go:7:2: cannot find package "github.com/go-sql-driver/mysql" in any of: gateway | /usr/local/go/src/github.com/go-sql-driver/mysql (from $GOROOT) gateway | /go/src/github.com/go-sql-driver/mysql (from $GOPATH) gateway | gateway.go:8:2: cannot find package "github.com/gorilla/mux" in any of: gateway | /usr/local/go/src/github.com/gorilla/mux (from $GOROOT) gateway | /go/src/github.com/gorilla/mux (from $GOPATH) gateway exited with code 1 </code></pre> <p>Why isn't the build step detecting my project's dependencies inside the <code>/example/vendor</code> folder?</p> <p>When I run <code>go run gateway/gateway.go</code> from my host OS, the command works.</p> <p><strong>Directory structure (mounted inside container at /example)</strong></p> <pre><code>~/g/s/g/c/golang-db-gateway-example git:master ❯❯❯ tree -L 3 . ├── README.md ├── client │   └── client.go ├── docker-compose.yml ├── gateway │   └── gateway.go ├── glide.lock ├── glide.yaml ├── tmp └── vendor └── github.com ├── go-sql-driver └── gorilla </code></pre> <hr> <p><br></p> <h2>Relevant files:</h2> <p><strong>docker-compose.yml</strong></p> <pre><code>mysql: container_name: mysql_server image: mysql:5.7.11 environment: - MYSQL_ROOT_PASSWORD=root ports: - 3306 gateway: container_name: gateway image: golang:1.6.0-alpine volumes: - ./:/example working_dir: /example/gateway command: go run gateway.go environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=sandbox links: - mysql </code></pre> <p><strong>gateway/gateway.go</strong></p> <pre><code>package main import ( "database/sql" "encoding/json" "fmt" _ "github.com/go-sql-driver/mysql" "github.com/gorilla/mux" "net/http" "os" ) var db *sql.DB func main() { r := mux.NewRouter() var e error db, e = sql.Open( "mysql", os.ExpandEnv("root:${MYSQL_SERVER_PASSWORD}@mysql_server:3306/${MYSQL_DATABASE}")) fmt.Print("error is", e) r.HandleFunc("/todos", getTodos).Methods("GET") http.ListenAndServe(":8080", r) fmt.Printf("gateway") } type todo struct{} func getTodos(w http.ResponseWriter, r *http.Request) { t := new(todo) s, _ := json.Marshal(t) w.Header().Set("Content-Type", "application/json; charset=UTF-8") fmt.Fprint(w, string(s)) } </code></pre> <h2><br><br></h2> <p><strong>Update 1</strong> I changed my data-volume mount path inside the container to mount the project under the containers $GOPATH</p> <pre><code>mysql: container_name: mysql_server image: mysql:5.7.11 environment: - MYSQL_ROOT_PASSWORD=root ports: - 3306 gateway: container_name: gateway image: golang:1.6.0-alpine volumes: - ./:/go/src/github.com/cflynn07/golang-db-gateway-example working_dir: /go/src/github.com/cflynn07/golang-db-gateway-example command: go run gateway/gateway.go environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=sandbox links: - mysql </code></pre> <p>However now docker appears to hang:</p> <pre><code>~/g/s/g/c/golang-db-gateway-example git:master ❯❯❯ docker-compose up gateway ✱ mysql_server is up-to-date Recreating gateway Attaching to gateway </code></pre> </div>

如何在docker容器中重新加载服务配置(php-fpm)?

<div class="post-text" itemprop="text"> <p>I need to run php-fpm with root user.</p> <p>I'm following steps on this page <a href="https://serverfault.com/a/789039/479680">Start PHP-FPM with root option automatically</a> but it looks like systemd and systemctl are not inluded in my baseimage ubuntu:16.04 then I can't reload service configuration.</p> <p>Then how to proceed else ? Today, i'm installing apache/php-fpm in the same container.</p> <p>Thanks in advance.</p> <p>Dockerfile :</p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>FROM ubuntu:16.04 # Installer Nano / Apache2 RUN apt-get update &amp;&amp; apt-get install -y \ apt-utils \ nano \ apache2 # Activer le module Apache mod_proxy_fcgi RUN a2enmod proxy_fcgi # Activer le module Apache mod_rewrite RUN a2enmod rewrite # Installation PHP + extensions / composer RUN apt-get install -y \ php-fpm \ php-mcrypt \ php-mysql \ php-apcu \ php-curl \ php-intl \ php-xdebug \ php-xml \ php-zip \ php-bcmath \ php-gd \ php-json \ php-ldap \ php-mbstring \ php-mysql \ php-pgsql \ php-sqlite3 \ php-xml \ php-xsl \ php-zip \ php-soap \ php-opcache \ composer # Creation dossier php pour pid/socket php-fpm RUN mkdir /run/php # Activer config RUN a2enconf php7.0-fpm EXPOSE 80 VOLUME /var/www/html WORKDIR /var/www/html # Clean up APT when done. RUN apt-get clean</code></pre> </div> </div> <p>My docker-compose file :</p> <p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>version: '2' services: apachephp: container_name: monserveur image: toto/apache2_php-fpm7.0.30:0.4 ports: - "80:80" volumes: - D:\projets\lab.magento225:/var/www/html links: - db:db tty: true db: container_name: mabdd image: mysql:5.6 ports: - "3306:3306" volumes: - D:\local.databases\lab.magento225:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=root pma: container_name: phpmyadmin image: phpmyadmin/phpmyadmin ports: - "8080:80" links: - db:db</code></pre> </div> </div> </div>

如何正确配置docker中的supervisor

<div class="post-text" itemprop="text"> <p>I have a working laravel environment using docker. my projects has multiple services in different container such as redis, mongodb, mysqldb and nodejs. I want to use supervisor on my project to interact with redis for the queues and php to run the job. I have done some testing and research but I really can't make it work. </p> <p>so here is my DockerFile:</p> <pre><code>FROM php:7.3-fpm # Copy composer.lock and composer.json COPY composer.lock composer.json /var/www/ # Set working directory WORKDIR /var/www # Install dependencies RUN apt-get update &amp;&amp; apt-get install -y \ build-essential \ mariadb-client \ libpng-dev \ libzip-dev \ libjpeg62-turbo-dev \ libfreetype6-dev \ locales \ zip \ jpegoptim optipng pngquant gifsicle \ vim \ unzip \ git \ curl \ cron \ supervisor # Clear cache RUN apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/* # Install extensions RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ RUN docker-php-ext-install gd RUN docker-php-ext-configure bcmath --enable-bcmath RUN docker-php-ext-install bcmath # install mongodb ext RUN pecl install mongodb \ &amp;&amp; docker-php-ext-enable mongodb # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Add user for laravel application RUN groupadd -g 1000 www RUN useradd -u 1000 -ms /bin/bash -g www www # Copy supervisor configs COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Copy existing application directory contents COPY . /var/www # Copy existing application directory permissions COPY --chown=www:www . /var/www COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf CMD ["/usr/bin/supervisord"] # Change current user to www USER www # Expose port 9000 and start php-fpm server EXPOSE 9000 CMD ["php-fpm"] </code></pre> <p>and my docker-compose.yml file</p> <pre><code>version: '3' services: #PHP Service php: build: context: . dockerfile: Dockerfile image: digitalocean.com/php container_name: php restart: unless-stopped tty: true environment: SERVICE_NAME: php SERVICE_TAGS: dev working_dir: /var/www volumes: - ./:/var/www - ./php/local.ini:/usr/local/etc/php/conf.d/local.ini - ./supervisord.conf:/etc/supervisor/conf.d/supervisord.conf networks: - app-network #NODEJS Service nodejs: image: node:10 container_name: nodejs restart: unless-stopped working_dir: /var/www volumes: - ./:/var/www tty: true networks: - app-network #Nginx Service nginx: image: nginx:alpine container_name: nginx restart: unless-stopped tty: true ports: - "80:80" - "443:443" volumes: - ./:/var/www - ./nginx/conf.d/:/etc/nginx/conf.d/ networks: - app-network #MySQL Service mysqldb: image: mysql:5.7.22 container_name: mysqldb restart: unless-stopped tty: true ports: - "3306:3306" environment: MYSQL_DATABASE: ${DB_DATABASE} MYSQL_USER: ${DB_USERNAME} MYSQL_PASSWORD: ${DB_PASSWORD} MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} SERVICE_TAGS: dev SERVICE_NAME: mysql volumes: - dbdata:/var/lib/mysql - ./mysql/my.cnf:/etc/mysql/my.cnf networks: - app-network #MongoDB Service mongodb: image: mongo:3 container_name: mongodb restart: unless-stopped tty: true ports: - "27017:27017" networks: - app-network #Redis Service redis: image: redis container_name: redis restart: unless-stopped tty: true ports: - "${REDIS_PORT}:6379" networks: - app-network #Docker Networks networks: app-network: driver: bridge #Volumes volumes: dbdata: driver: local </code></pre> <p>you might also want to see my supervisord.conf</p> <pre><code>[supervisord] user=www nodaemon=true logfile=/dev/null logfile_maxbytes=0 pidfile=/var/run/supervisord.pid loglevel = INFO [unix_http_server] file=/var/run/supervisor.sock chmod=0700 username=www password=www [supervisorctl] serverurl=unix:///var/run/supervisord.sock username=www password=www [rpcinterface:supervisor] supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface [program:php-fpm] command = /usr/local/sbin/php-fpm autostart=true autorestart=true priority=5 stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:ohwo-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/artisan horizon autostart=false autorestart=true user=www numprocs=1 redirect_stderr=true stdout_logfile=/var/www/laravel-worker.log </code></pre> <p>so from that setup. when the containers is UP it seems that supervisord is not working because if I run <code>php artisan horizon</code> manually on my php container the queuing works perfectly. btw horizon is the tool i use for queuing. </p> <p>and then I also try to run <code>supervisorctl</code> on my php container and I got this error <code>unix:///var/run/supervisord.sock no such file</code></p> <p>so I'm just pretty new to docker just started few months ago. I do know how to configure supervisord on linux but i can't make it work on docker. </p> <p>so please pardon my stupidity :) </p> </div>

如何在Docker容器中安装PHP的mod_rewrite模块?

<div class="post-text" itemprop="text"> <p>docker-compose.yml</p> <pre><code>version: "3.7" services: php: build: './php/' volumes: - ./public_html/www/:/var/www/html/ apache: build: './apache/' depends_on: - php - mysql ports: - "8080:80" volumes: - ./public_html/www/:/var/www/html/ #- ./log:/var/log/apache2 mysql: image: mysql:5.6.40 ports: - "3306:3306" environment: - MYSQL_DATABASE=el-cigarette - MYSQL_ROOT_PASSWORD=root phpmyadmin: image: phpmyadmin/phpmyadmin links: - mysql environment: PMA_HOST: mysql PMA_PORT: 3306 ports: - '8081:80' php/Dockerfile FROM php:7.0-apache MAINTAINER Webgriffe Srl &lt;support@webgriffe.com&gt; RUN docker-php-ext-install mysqli &amp;&amp; a2enmod rewrite apache/demo.apache.conf ServerName localhost LoadModule deflate_module /usr/local/apache2/modules/mod_deflate.so LoadModule proxy_module /usr/local/apache2/modules/mod_proxy.so LoadModule proxy_fcgi_module /usr/local/apache2/modules/mod_proxy_fcgi.so &lt;VirtualHost *:80&gt; # Proxy .php requests to port 9000 of the php-fpm container ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/var/www/html/$1 DocumentRoot /var/www/html/ DirectoryIndex index.php &lt;Directory /var/www/html/&gt; Options All AllowOverride All Order allow,deny Allow from all Require all granted &lt;/Directory&gt; # Send apache logs to stdout and stderr CustomLog /var/www/1 common ErrorLog /var/www/2 &lt;/VirtualHost&gt; </code></pre> <p>I inputted next commands docker-compose build docker-compose up -d</p> <p>And I get that output Creating docker-local2_mysql_1 ... done Creating docker-local2_php_1 ... done Creating docker-local2_phpmyadmin_1 ... done Creating docker-local2_apache_1 ... done</p> <pre><code>Farther I write this docker exec -it docker-local2_php_1 sh # php -m But I didn't see mod_rewrite module [PHP Modules] Core ctype curl date dom fileinfo filter ftp hash iconv json libxml mbstring mysqli mysqlnd openssl pcre PDO pdo_sqlite Phar posix readline Reflection session SimpleXML SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules] </code></pre> <p>My .htaccess file doesn't work Where did I go wrong? And what I need do to fix this trouble?</p> </div>

尝试连接到MongoDB容器时,GOLANG客户端Docker容器变得无法访问

<div class="post-text" itemprop="text"> <p>I have a simple program written in golang which connect to a mongodb instance thus:</p> <pre><code>func main() { session, err := mgo.Dial("localhost:27017") if err != nil { panic(err) } defer session.Close() session.SetMode(mgo.Monotonic, true) ensureIndex(session) } </code></pre> <p>I use docker compose to spin up two containers one to spin up my GOLANG API and the other to spin up mongo:</p> <pre><code>version: "3.3" services: api: image: golang:latest volumes: - .:/go working_dir: /go environment: - GOPATH=/go command: go run /go/src/main.go ports: - "8082:8000" depends_on: - db networks: - api-net db: build: . expose: - '27017' container_name: 'mongo' ports: - "27017:27017" networks: - api-net networks: api-net: driver: bridge </code></pre> <p>I use a Dockerfile in order to spin up mongo with a conf file that sets the instance to bind to all IPV4 and IPV6 networks:</p> <pre><code>FROM mongo:latest COPY mongod.conf /etc/mongod.conf CMD mongod --config /etc/mongod.conf## </code></pre> <p>and this is the mongod.conf file:</p> <pre><code>systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # network interfaces net: port: 27017 bindIp: 0.0.0.0 </code></pre> <p>When I run docker-compose.up this is what I get:</p> <pre><code>Building db Step 1/3 : FROM mongo:latest ---&gt; a0f922b3f0a1 Step 2/3 : COPY mongod.conf /etc/mongod.conf ---&gt; Using cache ---&gt; f270e718c11e Step 3/3 : CMD mongod --config /etc/mongod.conf ---&gt; Running in 89ffc2495a2a Removing intermediate container 89ffc2495a2a ---&gt; fe2677d53122 Successfully built fe2677d53122 Successfully tagged carsupermarket_db:latest WARNING: Image for service db was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating mongo ... done Creating carsupermarket_api_1 ... done Attaching to mongo, carsupermarket_api_1 api_1 | panic: no reachable servers api_1 | api_1 | goroutine 1 [running]: api_1 | main.main() api_1 | /go/src/main.go:38 +0x291 api_1 | exit status 2 </code></pre> <p>I've trawled Google and stackoverflow and the only thing I could manage to find which is vaguely related to my issue is:</p> <p><a href="https://stackoverflow.com/questions/38860308/mongod-bind-ip-using-docker-compose-version-2">mongod --bind_ip using docker-compose version 2</a></p> <p>however, my docker-compose.yml file as it stands 'Should' on paper work.</p> <p>Can someone please point me in the correct direction as to why my GOLANG code cannot find my mongodb instance. </p> </div>

无法连接到Docker容器内的postgresql

<div class="post-text" itemprop="text"> <p>I'm writing a go app which is dockerized in 2 containers: db and app.</p> <p>while starting containers 'docker-compose up' I see the message: <em>dial tcp: lookup dbpgsql on 127.0.0.11:53: no such host</em></p> <pre><code>DB_ENV_DB=cldb DB_ENV_USER=cldb DB_ENV_PASS=cldb DB_PORT_5432_TCP_ADDR=dbpgsql DB_PORT_5432_TCP_PORT=5432 </code></pre> <p>here is my docker-compose.yml</p> <pre><code>version: '2' services: server: hostname: app image: golang:1.7.3-alpine build: ./server/ privileged: true container_name: server command: go run server.go volumes: - ../src/:/go/src/ - ../server.go:/go/server.go links: - db:db ports: - '8080:8080' env_file: environment db: hostname: dbpgsql image: postgres:latest container_name: db environment: POSTGRES_USER: cldb POSTGRES_PASSWORD: cldb POSTGRES_DB: cldb ports: - '5432:5432' volumes: - ./data:/docker-entrypoint-initdb.d </code></pre> <p>The app fails here when DB.Ping() is executed:</p> <pre><code>func InitDB(dataSourceName string) { var err error DB, err = sql.Open("postgres", dataSourceName) if err != nil { log.Panic(err) } if err = DB.Ping(); err != nil { log.Panic(err) } DB.SetMaxIdleConns(100) } </code></pre> </div>

如何将Docker Web应用程序容器连接到Docker PostgreSQL容器?

<div class="post-text" itemprop="text"> <p>I'm practicing making a Golang web app that interacts with a PostgreSQL database, each running on their own container.</p> <p>I'm running the containers with <code>docker-compose up</code></p> <p>But I seem to be failing on getting the postgres container properly set up.</p> <p>For brevity, links to <code>Dockerfile</code>s and other settings files are <a href="https://gist.github.com/andradei/922e11f469aec277ab6e" rel="nofollow">on this gist</a> (let me know if you want it here instead).</p> <pre><code>version: '2' services: web_app: build: dockerfiles/web_app ports: - "9000:9000" volumes: - .:/go/src/gitlab.com/repo/web_app # links might be replaced by depends_on. # links: # - db depends_on: - db # tty and stdin_open cause docker-compose to disconnect from docker-machine after 60sec. # A fix is on the way. # tty: true # stdin_open: true db: build: dockerfiles/db volumes: - data:/var/lib/postgresql/data volumes: data: {} </code></pre> <p><code>docker-compose up</code> works fine. But when the application tries to open a database connection with:</p> <pre><code>var pgConf string = "user=web_app dbname=web_app sslmode=verify-full password=password" db, err := sql.Open("postgres", pgConf) </code></pre> <p>I get the following error from docker compose:</p> <pre><code>Error creating new user: dial tcp [::1]:5432: getsockopt: connection refused </code></pre> <p>What can I do to make both containers talk to each other?</p> <p>Thank you in advance.</p> </div>

Docker容器在本地连接到MySQL数据库 - >重定向到另一个容器

<div class="post-text" itemprop="text"> <p>I am new to Docker. </p> <p>I have read that it is better to keep an app per container. </p> <p>I need to run web app (LAMP stack). So I have found the container for running PHP + Apache. </p> <p>Now I need to set up a mysql container. But I am not sure what is the correct way to do that.</p> <p>I read that it is possible to connect multiple containers together. </p> <p>The idea is to make it trasnparent to the container running PHP + Apache when it tries to connect to mysql database locally.</p> <p>But redirect all local connections to another container.</p> <p>Another idea I have is to provide environment variable with host where should all connections go. In this case I need to have publicly accessible mysql server, but I need to keep it private and accessible only locally.</p> <p>Could you please suggest a better option to choose in my case ? </p> <p>Thank you</p> </div>

多个项目之间的Docker连接被拒绝

<div class="post-text" itemprop="text"> <p>I set up 2 projects (Admin and API) and try to move into docker on local.</p> <p>I can access the running web instances on both without any problems, but when the Admin tries to make a Curl requests to the API, I get a cURL error:</p> <blockquote> <p>cURL error 7: Failed to connect to localhost port 8080</p> </blockquote> <p>This is my docker-compose.yml file contents:</p> <pre><code>version: "3.1" services: memcached: image: memcached:alpine container_name: project-admin-memcached redis: image: redis:alpine container_name: project-admin-redis mariadb: image: mariadb:10.1 container_name: project-admin-mariadb working_dir: /application volumes: - ./Projects:/application environment: - MYSQL_ROOT_PASSWORD=docker - MYSQL_DATABASE=db_test - MYSQL_USER=test - MYSQL_PASSWORD=test ports: - "8083:3306" # docker-compose exec webserver sh # docker exec -it project-admin-webserver nginx -s reload webserver: image: nginx:alpine container_name: project-admin-webserver working_dir: /application volumes: - ./Projects/Api:/application/api - ./Projects/Admin:/application/admin - ./Docker/nginx:/etc/nginx/conf.d ports: - "8080:8080" - "8090:8090" # docker-compose exec php-fpm bash php-fpm: build: Docker/php-fpm container_name: project-admin-php-fpm working_dir: /application volumes: - ./Projects:/application - ./Docker/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini </code></pre> <p>I can access both projects from my browser with:</p> <p><a href="http://localhost:8080/" rel="nofollow noreferrer">http://localhost:8080/</a> &lt;= API</p> <p><a href="http://localhost:8090/" rel="nofollow noreferrer">http://localhost:8090/</a> &lt;= Admin</p> <p>How can I fix this?</p> </div>

java jdk 8 帮助文档 中文 文档 chm 谷歌翻译

JDK1.8 API 中文谷歌翻译版 java帮助文档 JDK API java 帮助文档 谷歌翻译 JDK1.8 API 中文 谷歌翻译版 java帮助文档 Java最新帮助文档 本帮助文档是使用谷

软件测试2小时入门

本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。

汽车行驶工况构建2019 D题.zip

1. 标记0与0之间的片段位置 2.标记所之间的毛刺数的位置 3.去掉毛刺数据 速度 并生成 新的数组 4.标记时间段 5. 0与0之间 如果有不连续的时间片段 置零 先找到时间间隔 再看间隔时间对应

Python+OpenCV计算机视觉

Python+OpenCV计算机视觉系统全面的介绍。

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

专为程序员设计的数学课

<p> 限时福利限时福利,<span>15000+程序员的选择!</span> </p> <p> 1、原价 115 元,限时特价仅需 49 元!<br> 2、购课后添加学习助手(微信号:csdnxy68),按提示消息领取编程大礼包!并获取讲师答疑服务! </p> <p> <br> </p> <p> 套餐中一共包含5门程序员必学的数学课程(共47讲) </p> <p> 课程1:《零基础入门微积分》 </p> <p> 课程2:《数理统计与概率论》 </p> <p> 课程3:《代码学习线性代数》 </p> <p> 课程4:《数据处理的最优化》 </p> <p> 课程5:《马尔可夫随机过程》 </p> <p> <br> </p> <p> 哪些人适合学习这门课程? </p> <p> 1)大学生,平时只学习了数学理论,并未接触如何应用数学解决编程问题; </p> <p> 2)对算法、数据结构掌握程度薄弱的人,数学可以让你更好的理解算法、数据结构原理及应用; </p> <p> 3)看不懂大牛代码设计思想的人,因为所有的程序设计底层逻辑都是数学; </p> <p> 4)想学习新技术,如:人工智能、机器学习、深度学习等,这门课程是你的必修课程; </p> <p> 5)想修炼更好的编程内功,在遇到问题时可以灵活的应用数学思维解决问题。 </p> <p> <br> </p> <p> 在这门「专为程序员设计的数学课」系列课中,我们保证你能收获到这些:<br> <br> <span> </span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">①价值300元编程课程大礼包</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">②应用数学优化代码的实操方法</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">③数学理论在编程实战中的应用</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">④程序员必学的5大数学知识</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">⑤人工智能领域必修数学课</span> </p> <p> <br> 备注:此课程只讲程序员所需要的数学,即使你数学基础薄弱,也能听懂,只需要初中的数学知识就足矣。<br> <br> 如何听课? </p> <p> 1、登录CSDN学院 APP 在我的课程中进行学习; </p> <p> 2、登录CSDN学院官网。 </p> <p> <br> </p> <p> 购课后如何领取免费赠送的编程大礼包和加入答疑群? </p> <p> 购课后,添加助教微信:<span> csdnxy68</span>,按提示领取编程大礼包,或观看付费视频的第一节内容扫码进群答疑交流! </p> <p> <img src="https://img-bss.csdn.net/201912251155398753.jpg" alt=""> </p>

微信公众平台开发入门

本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。

4小时玩转微信小程序——基础入门与微信支付实战

这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

IE主页被篡改修复

IE主页修复。IE主页被篡改修复。一键修复IE主页

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

土豆SDK(Java版)-非官方

由于土豆SDK一直建设中,最近几天抽空写了一套java的SDK。包含了现有的所有请求协议。本套SDK中仅提供了oAuth的方式(引用oAuth.net的java版示例),并没有在框架中实现,涉及到登录

Java8零基础入门视频教程

这门课程基于主流的java8平台,由浅入深的详细讲解了java SE的开发技术,可以使java方向的入门学员,快速扎实的掌握java开发技术!

【数据结构与算法综合实验】欢乐连连看(C++ & MFC)案例

这是武汉理工大学计算机学院数据结构与算法综合实验课程的第三次项目:欢乐连连看(C++ & MFC)迭代开发代码。运行环境:VS2017。已经实现功能:开始游戏、消子、判断胜负、提示、重排、计时、帮助。

数学建模竞赛D题“汽车行驶工况构建

第十六届“华为杯”数学建模竞赛D题“汽车行驶工况构建”论文。论文获得比赛国家二等奖,论文为原创,仅供参考。 关键词:数据处理;降维;聚类。

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

Android音视频开发全套

Android平台音视频开发全套,涉及:FFmpeg软解码解码、Mediacodec硬解码编码、Openssl音频播放、OpenGL ES视频渲染、RTMP推流等核心重要知识点。

设计模式(JAVA语言实现)--20种设计模式附带源码

课程亮点: 课程培训详细的笔记以及实例代码,让学员开始掌握设计模式知识点 课程内容: 工厂模式、桥接模式、组合模式、装饰器模式、外观模式、享元模式、原型模型、代理模式、单例模式、适配器模式 策略模式、模板方法模式、观察者模式、迭代器模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式 课程特色: 笔记设计模式,用笔记串连所有知识点,让学员从一点一滴积累,学习过程无压力 笔记标题采用关键字标识法,帮助学员更加容易记住知识点 笔记以超链接形式让知识点关联起来,形式知识体系 采用先概念后实例再应用方式,知识点深入浅出 提供授课内容笔记作为课后复习以及工作备查工具 部分图表(电脑PC端查看):

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

想学好JAVA必须要报两万的培训班吗? Java大神勿入 如果你: 零基础想学JAVA却不知道从何入手 看了一堆书和视频却还是连JAVA的环境都搭建不起来 囊中羞涩面对两万起的JAVA培训班不忍直视 在职没有每天大块的时间专门学习JAVA 那么恭喜你找到组织了,在这里有: 1. 一群志同道合立志学好JAVA的同学一起学习讨论JAVA 2. 灵活机动的学习时间完成特定学习任务+每日编程实战练习 3. 热心助人的助教和讲师及时帮你解决问题,不按时完成作业小心助教老师的家访哦 上一张图看看前辈的感悟: &nbsp; &nbsp; 大家一定迫不及待想知道什么是极简JAVA学习营了吧,下面就来给大家说道说道: 什么是极简JAVA学习营? 1. 针对Java小白或者初级Java学习者; 2. 利用9天时间,每天1个小时时间; 3.通过 每日作业 / 组队PK / 助教答疑 / 实战编程 / 项目答辩 / 社群讨论 / 趣味知识抢答等方式让学员爱上学习编程 , 最终实现能独立开发一个基于控制台的‘库存管理系统’ 的学习模式 极简JAVA学习营是怎么学习的? &nbsp; 如何报名? 只要购买了极简JAVA一:JAVA入门就算报名成功! &nbsp;本期为第四期极简JAVA学习营,我们来看看往期学员的学习状态: 作业看这里~ &nbsp; 助教的作业报告是不是很专业 不交作业打屁屁 助教答疑是不是很用心 &nbsp; 有奖抢答大家玩的很嗨啊 &nbsp; &nbsp; 项目答辩终于开始啦 &nbsp; 优秀者的获奖感言 &nbsp; 这是答辩项目的效果 &nbsp; &nbsp; 这么细致的服务,这么好的氛围,这样的学习效果,需要多少钱呢? 不要1999,不要199,不要99,只要9.9 是的你没听错,只要9.9以上所有就都属于你了 如果你: 1、&nbsp;想学JAVA没有基础 2、&nbsp;想学JAVA没有整块的时间 3、&nbsp;想学JAVA没有足够的预算 还等什么?赶紧报名吧,抓紧抢位,本期只招300人,错过只有等时间待定的下一期了 &nbsp; 报名请加小助手微信:eduxy-1 &nbsp; &nbsp;

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

web网页制作期末大作业

分享思维,改变世界. web网页制作,期末大作业. 所用技术:html css javascript 分享所学所得

手把手实现Java图书管理系统(附源码)

【超实用课程内容】 本课程演示的是一套基于Java的SSM框架实现的图书管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的java人群。详细介绍了图书管理系统的实现,包括:环境搭建、系统业务、技术实现、项目运行、功能演示、系统扩展等,以通俗易懂的方式,手把手的带你从零开始运行本套图书管理系统,该项目附带全部源码可作为毕设使用。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27513 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化 下载方式:电脑登录https://edu.csdn.net/course/detail/27513,点击右下方课程资料、代码、课件等打包下载

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

2019 Python开发者日-培训

本次活动将秉承“只讲技术,拒绝空谈”的理念,邀请十余位身处一线的Python技术专家,重点围绕Web开发、自动化运维、数据分析、人工智能等技术模块,分享真实生产环境中使用Python应对IT挑战的真知灼见。此外,针对不同层次的开发者,大会还安排了深度培训实操环节,为开发者们带来更多深度实战的机会。

C++语言基础视频教程

C++语言基础视频培训课程:本课与主讲者在大学开出的程序设计课程直接对接,准确把握知识点,注重教学视频与实践体系的结合,帮助初学者有效学习。本教程详细介绍C++语言中的封装、数据隐藏、继承、多态的实现等入门知识;主要包括类的声明、对象定义、构造函数和析构函数、运算符重载、继承和派生、多态性实现等。 课程需要有C语言程序设计的基础(可以利用本人开出的《C语言与程序设计》系列课学习)。学习者能够通过实践的方式,学会利用C++语言解决问题,具备进一步学习利用C++开发应用程序的基础。

零基础学C#编程—C#从小白到大咖

本课程从初学者角度出发,提供了C#从入门到成为程序开发高手所需要掌握的各方面知识和技术。 【课程特点】 1 由浅入深,编排合理; 2 视频讲解,精彩详尽; 3 丰富实例,轻松易学; 4 每章总结配有难点解析文档。 15大章节,228课时,1756分钟与你一同进步!

编程实现学生基本信息管理程序

编程实现学生基本信息管理程序。学生基本信息包括:学号、姓名、性别、年龄、班级、学院、专业等。具体实现的管理功能如下: (1) 输入并显示多个学生的基本信息; (2) 可根据需要实现学生信息的添加; (

android 漂亮的UI界面 完整的界面设计

声明:这也是我学习时在网上下载的,鉴于分享精神,并且觉得很不错才上传上来的。。。。。 android 漂亮的UI界面 完整的界面设计 这是一个完整的UI设计,但是没写动作,这是一个公司程序员的公司任务

Anaconda详细安装及使用教程(带图文)

Anacond的介绍 Anaconda指的是一个开源的Python发行版本,其包含了conda、Python等180多个科学包及其依赖项。 因为包含了大量的科学包,Anaconda 的下载文件比较大(约 531 MB),如果只需要某些包,或者需要节省带宽或存储空间,也可以使用Miniconda这个较小的发行版(仅包含conda和 Python)。 Conda是一个开源的包、环境管理器,可以用于...

DirectX修复工具V4.0增强版

DirectX修复工具(DirectX Repair)是一款系统级工具软件,简便易用。本程序为绿色版,无需安装,可直接运行。 本程序的主要功能是检测当前系统的DirectX状态,如果发现异常则进行修复

相关热词 c# 局部 截图 页面 c#实现简单的文件管理器 c# where c# 取文件夹路径 c# 对比 当天 c# fir 滤波器 c# 和站 队列 c# txt 去空格 c#移除其他类事件 c# 自动截屏
立即提问