docker 上部署 .netcore API swagger 无法访问。

本地是可以运行的,部署到docker上,网站可以打开,但是连接 swagger 就出错。
docker 运行情况





qq_36510936 xml地址已经不是原来那个了
4 个月之前 回复
qq_36510936 ss
4 个月之前 回复
带我回火星 端口肯定正确的,不然第一个页面都访问不了
一年多之前 回复
Csdn user default icon

<div class="post-text" itemprop="text"> <p>My problem is that I get an error when running my container on an ARM arch system(RaspberryPI with Raspbian). Image was built on that same Raspberry. </p> <p>This is my <code>dockerfile</code>:</p> <pre><code>FROM arm32v7/golang COPY qemu-arm-static /usr/bin ENV STATUSOK_VERSION 0.1.1 RUN apt-get update \ &amp;&amp; apt-get install -y unzip \ &amp;&amp; wget$STATUSOK_VERSION/ \ &amp;&amp; unzip \ &amp;&amp; mv ./statusok_linux/statusok /go/bin/StatusOk \ &amp;&amp; rm -rf ./statusok_linux* \ &amp;&amp; apt-get remove -y unzip git \ &amp;&amp; apt-get autoremove -y \ &amp;&amp; apt-get clean \ &amp;&amp; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* VOLUME /config COPY ./ / ENTRYPOINT / </code></pre> <p>I'm able to succesfully build this on a RaspberryPI running Raspbian:</p> <pre><code>root@raspberrypi:~/armstatusok# docker build . -t armstatusok Sending build context to Docker daemon 6.656kB Step 1/7 : FROM arm32v7/golang ---&gt; 8bbfdfd01a06 Step 2/7 : COPY qemu-arm-static /usr/bin ---&gt; Using cache ---&gt; 2572fd1e03a0 Step 3/7 : ENV STATUSOK_VERSION 0.1.1 ---&gt; Using cache ---&gt; 25d39a4c6eb5 Step 4/7 : RUN apt-get update &amp;&amp; apt-get install -y unzip &amp;&amp; wget$STATUSOK_VERSION/ &amp;&amp; unzip &amp;&amp; mv ./statusok_linux/statusok /go/bin/StatusOk &amp;&amp; rm -rf ./statusok_linux* &amp;&amp; apt-get remove -y unzip git &amp;&amp; apt-get autoremove -y &amp;&amp; apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ---&gt; Using cache ---&gt; bfb1cfa9a985 Step 5/7 : VOLUME /config ---&gt; Using cache ---&gt; 3bfbce28329b Step 6/7 : COPY ./ / ---&gt; Using cache ---&gt; a1795ca4f40c Step 7/7 : ENTRYPOINT / ---&gt; Using cache ---&gt; d0ce74911ba3 Successfully built d0ce74911ba3 Successfully tagged armstatusok:latest </code></pre> <p>Next step is to run it, and where I get into trouble:</p> <pre><code>root@raspberrypi:~/armstatusok# docker run --name=armstatusok -v $PWD:/config armstatusok / 1: / /go/bin/StatusOk: not found </code></pre> <p>I went into the container commenting line one of the <code></code> and checked if <code>/go/bin/StatusOk</code> was actually there, and it was.</p> <p>My <code></code>:</p> <pre><code>root@raspberrypi:~/armstatusok# cat /go/bin/StatusOk --config /config/config.json </code></pre> <p>Now my question is, does anybody have a clue where to start? I also tested this dockerfile on x86 arch, and there it worked. I only changed the FROM line to the x86 flavour and removed the <code>COPY qemu-arm-static /usr/bin</code> since that line is there to make it work on ARM arch, according to documentation.</p> </div>

将docker-compose.yml转换为DockerAPI / services / create接受的json?

<div class="post-text" itemprop="text"> <p>I want to deploy service into already running Docker Stack via Docker API for Go-lang.</p> <p>As dockerAPI only accepts json as described in their <a href="" rel="nofollow noreferrer">docs</a>, I an searching for a tool that could covert compose.yaml to the json accepted by dockerAPI.</p> <p>Alternatively, it would be great if there is any method in go-lang DockerAPI that can create service directly using yaml data as we provide in compose.yml. </p> <p>Example Yaml:</p> <p><code>myapp: image: amithp/pyapp:latest deploy: replicas: 3 restart_policy: condition: on-failure networks: - frontend-network environment: - MYENV=myapp labels: myproject: "xyz" label1: "somevar"</code></p> <p>I am fairly new to both DockerAPI and Go-lang, any suggestion or direction will be greatly helpful.</p> </div>


电脑突然蓝屏,然后重启,重启时显示磁盘恢复,再次打开Docker时出现了如下的问题(蓝屏之前没有使用Docker): ![图片说明]( 请问如何解决!!!??? 报错如下: Docker.Core.DockerException: Docker.Core.Backend.BackendDestroyException: Unable to create Hyper-V VM: 无法新建虚拟机。 “DockerDesktopVM”无法实现。(虚拟机 ID D1838917-98C7-4C3B-AEE2-BE95D3632D4D) 无法访问配置存储: 找不到指定文件的虚拟磁盘支持提供程序。 (0xC03A0014)。 在 New-MobyLinuxVM、<无文件> 中: 第 397 行 在 New-MobyLinux、<无文件> 中: 第 182 行 在 <ScriptBlock>、<无文件> 中: 第 810 行 在 Docker.Backend.ContainerEngine.Linux.Start(Settings settings, String daemonOptions, Credential credential) 在 Docker.Backend.BackendNamedPipeServer.<Run>b__8_2(Object[] args) 在 Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass9_0.<Register>b__0(Object[] parameters) 在 Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters) System.Management.Automation.RuntimeException: Unable to create Hyper-V VM: 无法新建虚拟机。 “DockerDesktopVM”无法实现。(虚拟机 ID D1838917-98C7-4C3B-AEE2-BE95D3632D4D) 无法访问配置存储: 找不到指定文件的虚拟磁盘支持提供程序。 (0xC03A0014)。 在 New-MobyLinuxVM、<无文件> 中: 第 397 行 在 New-MobyLinux、<无文件> 中: 第 182 行 在 <ScriptBlock>、<无文件> 中: 第 810 行 在 Docker.Backend.HyperV.HandleException(String action, Exception ex) 在 Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters, PowerShellConfiguration config) 在 Docker.Backend.HyperV.Create(Settings settings) 在 Docker.Backend.ContainerEngine.Linux.Start(Settings settings, String daemonOptions, Credential credential) Microsoft.HyperV.PowerShell.VirtualizationException: 无法新建虚拟机。 “DockerDesktopVM”无法实现。(虚拟机 ID D1838917-98C7-4C3B-AEE2-BE95D3632D4D) 无法访问配置存储: 找不到指定文件的虚拟磁盘支持提供程序。 (0xC03A0014)。 Microsoft.Virtualization.Client.Management.VirtualizationOperationFailedException: 无法新建虚拟机。 “DockerDesktopVM”无法实现。 在 Microsoft.Virtualization.Client.Management.View.EndMethodReturnInternal(IVMTask task, VirtualizationOperation operation, Boolean affectedElementExpected) 在 Microsoft.Virtualization.Client.Management.View.EndMethodReturn[AffectedElementType](IVMTask task, VirtualizationOperation operation, Boolean throwIfAffectedElementNotFound) 在 Microsoft.Virtualization.Client.Management.View.EndMethodReturn[AffectedElementType](IVMTask task, VirtualizationOperation operation) 在 Microsoft.Virtualization.Client.Management.VMServiceView.EndCreateVirtualSystem[T](IVMTask task) 在 Microsoft.HyperV.PowerShell.ExtensionMethods.OperationWatcherExtensions.PerformOperationWithReturn[T](IOperationWatcher watcher, Func`1 startTaskMethod, Func`2 endTaskMethod, String taskDescription, VirtualizationObject targetObject) 在 Microsoft.HyperV.PowerShell.VirtualMachine.Create(Server server, String name, String location, Int32 generation, Version version, IOperationWatcher operationWatcher) 在 Microsoft.HyperV.PowerShell.Commands.NewVM.CreateVirtualMachine(Server server, IOperationWatcher operationWatcher) 在 Microsoft.HyperV.PowerShell.Commands.NewVM.CreateObjects(IOperationWatcher operationWatcher) 在 Docker.Core.Pipe.NamedPipeClient.<TrySendAsync>d__5.MoveNext() --- 引发异常的上一位置中堆栈跟踪的末尾 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters) 在 Docker.Actions.DoStart(SynchronizationContext syncCtx, Boolean showWelcomeWindow, Boolean withNotifications) 在 Docker.Actions.<>c__DisplayClass26_0.<StartAsync>b__0() 在 Docker.ApiServices.TaskQueuing.TaskQueue.<>c__DisplayClass18_0.<.ctor>b__1()


<div class="post-text" itemprop="text"> <p>I am building a go app inside a docker container</p> <p>When I try to run a docker container inside Golang with this command preview</p> <pre><code>docker build -f Dockerfile.local -t myGoApp:exp . &amp;&amp; docker run -v /volume:/go --name myGoApp --env-file ./test.env --network=myGoApp_network myGoApp:exp </code></pre> <p>I get: </p> <pre><code>Building image... Failed to deploy 'myGoApp Dockerfile: Dockerfile.local': com.github.dockerjava.api.exception.DockerClientException: Error occurred while preparing Docker context folder.&lt;br/&gt;caused by: /home/julien/go/src/ (No such file or directory) </code></pre> <p>When I run the same command on a terminal, it works</p> <p>When I run the equivalent inside a docker compose via Goland, it also works.</p> <p>I also checked, and the <code>.eslintrc</code> in question exists.</p> <p>Why is it happening ? Googling, I could find that it has to do with docker-java, but I could not really find a way to solution.</p> <p>Here is docker version info:</p> <pre><code>Client: Version: 18.09.1 API version: 1.39 Go version: go1.10.6 Git commit: 4c52b90 Built: Wed Jan 9 19:35:31 2019 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 18.09.1 API version: 1.39 (minimum version 1.12) Go version: go1.10.6 Git commit: 4c52b90 Built: Wed Jan 9 19:02:44 2019 OS/Arch: linux/amd64 Experimental: false </code></pre> <p>Any idea what's wrong ? I need to launch it that way because I want to implement debugging inside a container like explained <a href="" rel="nofollow noreferrer">here</a></p> </div>


<div class="post-text" itemprop="text"> <p>I'm writing some code that takes in a Docker-Compose.yml and unmarshals it into a struct. I take the docker compose data in as a []byte.</p> <pre><code> dockerData []byte var struct *struct if err := yaml.Unmarshal(dockerData, &amp;struct) </code></pre> <p>I run a lot of compose files through this process. When errors are thrown, is there a way to output the line or section of the compose file that threw the error?</p> </div>


<div class="post-text" itemprop="text"> <p>I'm working on a docker project and I want to run a php file which will configure the database for the project.</p> <p>My Docker file : </p> <pre><code>FROM php:7.2-apache LABEL maintainer="" COPY site/ /var/www/html RUN chmod -R 777 /var/www/html RUN docker-php-ext-install mysqli COPY 000-default.conf /etc/apache2/sites- available/000-default.conf EXPOSE 80 CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] </code></pre> <p>My docker-compose.yml</p> <pre><code>version: '3.1' services: db: image: mysql command: --default-authentication-plugin=mysql_native_password restart: always environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: group_db server: image : apache ports: - "80:80" </code></pre> <p>I want to run the install.php which will be in /var/www/html/ directory. How can I do that?</p> <p><strong>Edit : I want to run this file automatically after the container is up</strong></p> </div>


首先在本地建了一个dockerfile、docker-entrypoint.sh和requirements.txt文件,dockerfile文件 内容为: ``` FROM MAINTAINER Captain Dao <> RUN mkdir -p /app WORKDIR /app ADD requirements.txt requirements.txt RUN pip install -r requirements.txt COPY /usr/local/bin/ RUN chmod +x /usr/local/bin/ EXPOSE 8888 ENTRYPOINT [""] CMD [""] ``` 创建完这三个文件后需要在本地创建镜像了,我使用命令: ``` sudo docker build . ``` 创建好镜像后可以用命令找到该镜像,如图: ![图片说明]( 我有三个问题: 1 网站有教程说创建镜像的命令是 ``` sudo build -t ipython/notebook . ``` 而我用的是 ``` sudo docker build . ``` 请问这两个命令有什么区别,中间有个ipython/notebook是做什么的? 2请问build后面的那个“.”是什么意思? 3请问在创建镜像的时候如何给镜像加上名字。 谢谢。

Docker - 环境变量不会覆盖php.ini

<div class="post-text" itemprop="text"> <p>I'm having a custom php app running on docker. I have set up some env variables for configuring the php.ini or the apache but when I do <code>docker-compose up --build</code> and try to access the app (index.php) from the browser I can see the env variables have not overwritting the php.ini file or the apache conf. Any ideas what I'm doing wrong?</p> <p>These are my files</p> <p>docker-compose.yml</p> <pre><code>services: app: container_name: myapp build: context: . dockerfile: docker/Dockerfile volumes: - .:/var/www/html ports: - 8080:80 env_file: - ./.env networks: - appnet </code></pre> <p>Dockerfile</p> <pre><code>FROM php:7.3-apache-stretch COPY docker/vhost.conf /etc/apache2/sites-available/000-default.conf COPY docker/config/php/php.ini /usr/local/etc/php/php.ini COPY docker/config/php/conf.d/*.ini /usr/local/etc/php/conf.d/ COPY . /var/www/html/ WORKDIR /var/www/html/ </code></pre> <p>php.ini</p> <pre><code>date.timezone = ${PHP_DATE_TIMEZONE} display_errors = ${PHP_DISPLAY_ERRORS} error_reporting = ${PHP_ERROR_REPORTING} </code></pre> <p>.env</p> <pre><code>PHP_DATE_TIMEZONE = Europe/London PHP_DISPLAY_ERRORS = 1 PHP_ERROR_REPORTING = -1 </code></pre> <p>index.php</p> </div>


command 使用 command 可以覆盖容器启动后默认执行的命令。 command: bundle exec thin -p 3000 这个具体怎么使用啊,能不能举例说明


<div class="post-text" itemprop="text"> <p>I am trying to install Grafana with docker-compose.yml and Dockerfile. This is giving me error of "go command not found"; I think this is because gopath is not setup properly. Same commands I have run one by one in host machine everything is working but same process I am trying with Docker and it is giving me error.</p> <p>NOTE for error checking please click on link in last.</p> <p>My docker-compose.yml file </p> <pre><code>version: '3' services: web: build: . container_name: grafana ports: - "9000:3000" expose: - 9000 volumes: - .:/newvolebs networks: - overlay environment: MYSQL_HOST: mysql MYSQL_DATABASE: grafana MYSQL_USERNAME: root MYSQL_PASSWORD: 12345 mysql: image: mysql:5.6 ports: - "3306:3306" expose: - 3306 volumes: - newvolebs:/var/lib/mysql networks: - overlay environment: MYSQL_ROOT_PASSWORD: 12345 MYSQL_DATABASE: grafana volumes: newvolebs: driver: local networks: overlay: driver: "bridge" </code></pre> <p>my DockerFile</p> <pre><code>FROM centos:centos7 RUN useradd centos &amp;&amp; \ yum install -y sudo &amp;&amp; \ echo "centos ALL=(ALL) NOPASSWD: ALL" &gt;&gt; /etc/sudoers USER centos ENV PATH="/home/centos/go:${PATH}" RUN sudo cd /home/centos &amp;&amp; \ sudo yum -y update &amp;&amp; \ sudo yum --setopt=tsflags=nodocs -y install \ wget \git \ gcc-c++ make \tar &amp;&amp; \ sudo wget &amp;&amp; \ sudo tar -xzvf go1.11.2.linux-amd64.tar.gz &amp;&amp; \ sudo mv go gocode &amp;&amp; \ curl --silent --location | sudo bash &amp;&amp; \ sudo yum -y install nodejs &amp;&amp; \ yum clean all &amp;&amp; \ sudo chmod 666 ~/.bashrc &amp;&amp; \ sudo echo "export GOROOT=$HOME/gocode" &gt;&gt; ~/.bashrc \ &amp;&amp; sudo echo "export PATH=$PATH:$GOROOT/bin" &gt;&gt; ~/.bashrc \ &amp;&amp; sudo echo "export GOPATH=$HOME/go" &gt;&gt; ~/.bashrc \ &amp;&amp; sudo echo "export PATH=$PATH:$GOPATH/bin" &gt;&gt; ~/.bashrc &amp;&amp; \ PATH="${GOROOT}/bin:$PATH}" &amp;&amp; \ export GOPATH=/home/centos/go &amp;&amp; \ export GOROOT=/home/centos/gocode &amp;&amp; \ source /home/centos/.bashrc &amp;&amp; \ sudo mkdir -p $HOME/go/{src,pkg,bin} &amp;&amp; \ cd $GOPATH/src &amp;&amp; \ go get &amp;&amp; \ cd $GOPATH/src/ &amp;&amp; \ go run build.go setup \ go run build.go build &amp;&amp; \ npm install -g yarn &amp;&amp; \ yarn install --pure-lockfile &amp;&amp; \ yarn watch &amp;&amp; \ cd go/src/ &amp;&amp; \ grafana-server \ echo "[main_settings]" &gt; /var/www/html/config.ini \ &amp;&amp; echo "headerTitle='Dashboard'" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "encryptKey='ffgfjhvjhvjcfgfjj'" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo ";Timezone Setting. ex: 'America/New_York'" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "defaultTimezone=''" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo ";Database parameters for system usage (Should not be used by custom dashboard/charts)" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "dashboardDatabaseServer=mysql" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "dashboardDatabaseName=dashboard" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "dashboardDatabaseUserName=root" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "dashboardDatabasePassword=12345 &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo ";grafana credentials" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "grafanaDatabaseServer=mysql" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "grafanaDatabaseName=grafana" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "grafanaDatabaseUserName=root" &gt;&gt; /var/www/html/config.ini \ &amp;&amp; echo "grafanaDatabasePassword=12345" &gt;&gt; /var/www/html/config.ini &amp;&amp; \ EXPOSE 9000 WORKDIR /home/centos </code></pre> <p><a href="" rel="nofollow noreferrer">This is the error when I execute docker-compose build</a></p> </div>


我想利用docker-compose同时启动多个容器,然后在每个容器启动后去执行一个自定义的 shell脚本,容器全部启动后执行也可以,主要是想在shell命令中能读取 .env中的配置项。 不知道在docker-compose.yml中能不能实现。 不明白 docker-compose中的command怎么使用


<div class="post-text" itemprop="text"> <p>So I have a Go application that I am deploying to a EC2 instance with Ansible and Jenkins pipeline as a Docker image. I have an image that I can access from outside the host using the IP address and the port number, 8080, using Postman. When I deploy a new image I cannot get a response using the ip address and port number. When I ssh into the server I can reach the endpoint using <strong>localhost</strong> and the port number. If I stop that image and start the first I can then reach it again. </p> <p>What are the possible differences between these images that makes it so the endpoint can no longer be accessed via the ip address?</p> <p>My Docker Compose File:</p> <pre><code>version: '2' services: project-1: image: ... volumes: - /var/log:/var/log network_mode: host environment: - ... cpu_shares: 1236 mem_limit: 2619m </code></pre> <p>My DockerFile:</p> <pre><code>FROM golang:1.10 WORKDIR /go/src/... COPY . . RUN go get -d -v ./... RUN go install -v ./... EXPOSE 8080-8080 CMD ./ </code></pre> <p>I have also attempted removing network_mode from Docker Compose file and replacing it with ports as shown below with no success:</p> <pre><code>ports: - "" </code></pre> </div>

使用Docker API for GO时出现问题-无法导入“ nat”

<div class="post-text" itemprop="text"> <p>I am trying to use the docker API for golang that is available from So far I am able to start the containers on the port that is predefined during image built. I am trying to map the port during runtime using the API; something equivalent to </p> <pre><code>docker run -p 8083:8082 -d myImage:1.0.0 </code></pre> <p>I tried to do something like the following for mapping the ports:</p> <pre><code>host_config := &amp;container.HostConfig{ PortBindings: nat.PortMap{ "8082/tcp": []nat.PortBinding{ { HostIP: "", HostPort: "8983", }, }, }, } </code></pre> <p>The problem here is that the variable "nat" lives inside the vendor folder of the API. I couldn't import something directly from the go vendor folder. Someone on the stackoverflow suggested to copy the go-connection folder into the github folder and remove the nested vendor directory. I did as suggested and created a path as follows:</p> <p><code>""</code></p> <p>now I get the following error during compile time:</p> <pre><code>src\main\createcontainer1.go:53: cannot use "".PortSet literal (type "".PortSet) as type "".PortSet in field value src\main\createcontainer1.go:65: cannot use "".PortMap literal (type "".PortMap) as type "".PortMap in field value </code></pre> <p>Have anyone faced this issue and overcome it? I am using the Go ver 1.8. </p> </div>


<div class="post-text" itemprop="text"> <p>I want to be able to shutdown a docker process gracefully. I derived the these files by following the idea in this blog post: <a href="" rel="nofollow noreferrer"></a></p> <p>Here are my files </p> <p>1) Dockerfile</p> <pre><code>FROM debian:jessie ADD app /app RUN apt-get update --fix-missing RUN apt-get install -y golang CMD ["go", "run", "/app/main.go"] </code></pre> <p>2) app/main.go</p> <pre><code>package main import "os" import "syscall" import "fmt" import "time" import "os/signal" func main() { // create a "returnCode" channel which will be the return code of the application var returnCode = make(chan int) // finishUP channel signals the application to finish up var finishUP = make(chan struct{}) // done channel signals the signal handler that the application has completed var done = make(chan struct{}) // gracefulStop is a channel of os.Signals that we will watch for -SIGTERM var gracefulStop = make(chan os.Signal) // watch for SIGTERM and SIGINT from the operating system, and notify the app on // the gracefulStop channel signal.Notify(gracefulStop, syscall.SIGTERM) signal.Notify(gracefulStop, syscall.SIGINT) // launch a worker whose job it is to always watch for gracefulStop signals go func() { // wait for our os signal to stop the app // on the graceful stop channel // this goroutine will block until we get an OS signal sig := &lt;-gracefulStop fmt.Printf("caught sig: %+v", sig) // send message on "finish up" channel to tell the app to // gracefully shutdown finishUP&lt;-struct{}{} // wait for word back if we finished or not select { case &lt;-time.After(30*time.Second): // timeout after 30 seconds waiting for app to finish, // our application should Exit(1) returnCode&lt;-1 case &lt;-done: // if we got a message on done, we finished, so end app // our application should Exit(0) returnCode&lt;-0 } }() // ... Do business Logic in goroutines fmt.Println("waiting for finish") // wait for finishUP channel write to close the app down &lt;-finishUP fmt.Println("stopping things, might take 2 seconds") // ... Do business Logic for shutdown simulated by Sleep 2 seconds time.Sleep(2*time.Second) // write to the done channel to signal we are done. done &lt;-struct{}{} os.Exit(&lt;-returnCode) } </code></pre> <p>I build the image by running</p> <pre><code>docker build -f Dockerfile -t docker-shutdown . </code></pre> <p>I start a container by </p> <pre><code>docker run docker-shutdown </code></pre> <p>Then I try to shut it down by</p> <pre><code>docker stop &lt;container id&gt; </code></pre> <p>In the console that runs 'docker run', I can see:</p> <pre><code>waiting for finish </code></pre> <p>and it just terminated with no further output.</p> <p>I would expect to see at least some output like</p> <pre><code> caught sig &lt;SIGNAL_VALUE&gt; </code></pre> <p>So why my expected behavior did not happen? I am also new to <code>go</code> so I am not sure if it may have something to do with the <code>go</code> code or the <code>CMD</code> definition in the <code>Dockerfile</code>.</p> <p>My question:</p> <p>Why the <code>go</code> process cannot catch the either <strong>TERM</strong> and <strong>KILL</strong> signals?</p> </div>

DNS设置转发,无法解析 域名

公司是域环境在DNS设置了转发,转发到114.114.114.114,但是无法解析,其他国内域名都正常。客户端手动配置DNS为114是可以解析 index.docker.io的。 我在测试环境也尝试设置转发到114.也可以正常解析。现在基本判定是我的DNS问题,但是不知道出在哪里。 下面是我的调试日志,这是个无法解析的。 2015/10/29 11:19:25 0DC4 PACKET 00000000074F8D40 UDP Snd d46d R Q [8081 DR NOERROR] A (5)index(6)docker(2)io(0) UDP response info at 00000000074F8D40 Socket = 352 Remote addr, port 64564 Time Query=15122162, Queued=15122162, Expire=15122165 Buf length = 0x0200 (512) Msg length = 0x0099 (153) Message: XID 0xd46d Flags 0x8180 QR 1 (RESPONSE) OPCODE 0 (QUERY) AA 0 TC 0 RD 1 RA 1 Z 0 CD 0 AD 0 RCODE 0 (NOERROR) QCOUNT 1 ACOUNT 2 NSCOUNT 0 ARCOUNT 0 QUESTION SECTION: Offset = 0x000c, RR count = 0 Name "(5)index(6)docker(2)io(0)" QTYPE A (1) QCLASS 1 ANSWER SECTION: Offset = 0x0021, RR count = 0 Name "[C00C](5)index(6)docker(2)io(0)" TYPE CNAME (5) CLASS 1 TTL 170 DLEN 28 DATA (6)elb-io(9)us-east-1(3)aws(4)dckr[C019](2)io(0) Offset = 0x0049, RR count = 1 Name "[C02D](6)elb-io(9)us-east-1(3)aws(4)dckr[C019](2)io(0)" TYPE CNAME (5) CLASS 1 TTL 132 DLEN 68 DATA (38)us-east-1-elbio-rm5bon1qaeo4-623296237(9)us-east-1(3)elb(9)amazonaws(3)com(0) AUTHORITY SECTION: empty ADDITIONAL SECTION: empty 正常解析的日志是这样的 2015/10/29 14:02:29 0DC4 PACKET 00000000033528F0 UDP Snd 1713 R Q [8081 DR NOERROR] A (5)index(6)docker(2)io(0) UDP response info at 00000000033528F0 Socket = 352 Remote addr, port 62417 Time Query=15131945, Queued=0, Expire=0 Buf length = 0x0fa0 (4000) Msg length = 0x00c9 (201) Message: XID 0x1713 Flags 0x8180 QR 1 (RESPONSE) OPCODE 0 (QUERY) AA 0 TC 0 RD 1 RA 1 Z 0 CD 0 AD 0 RCODE 0 (NOERROR) QCOUNT 1 ACOUNT 5 NSCOUNT 0 ARCOUNT 0 QUESTION SECTION: Offset = 0x000c, RR count = 0 Name "(5)index(6)docker(2)io(0)" QTYPE A (1) QCLASS 1 ANSWER SECTION: Offset = 0x0021, RR count = 0 Name "[C00C](5)index(6)docker(2)io(0)" TYPE CNAME (5) CLASS 1 TTL 15 DLEN 28 DATA (6)elb-io(9)us-east-1(3)aws(4)dckr[C019](2)io(0) Offset = 0x0049, RR count = 1 Name "[C02D](6)elb-io(9)us-east-1(3)aws(4)dckr[C019](2)io(0)" TYPE CNAME (5) CLASS 1 TTL 15 DLEN 68 DATA (38)us-east-1-elbio-rm5bon1qaeo4-623296237(9)us-east-1(3)elb(9)amazonaws(3)com(0) Offset = 0x0099, RR count = 2 Name "[C055](38)us-east-1-elbio-rm5bon1qaeo4-623296237(9)us-east-1(3)elb(9)amazonaws(3)com(0)" TYPE A (1) CLASS 1 TTL 15 DLEN 4 DATA Offset = 0x00a9, RR count = 3 Name "[C055](38)us-east-1-elbio-rm5bon1qaeo4-623296237(9)us-east-1(3)elb(9)amazonaws(3)com(0)" TYPE A (1) CLASS 1 TTL 15 DLEN 4 DATA Offset = 0x00b9, RR count = 4 Name "[C055](38)us-east-1-elbio-rm5bon1qaeo4-623296237(9)us-east-1(3)elb(9)amazonaws(3)com(0)" TYPE A (1) CLASS 1 TTL 15 DLEN 4 DATA AUTHORITY SECTION: empty ADDITIONAL SECTION: empty


jenkins做持续部署,现在已经把它搭建好了,可以实现单个微服部署到服务器docker容器中。 但我现在有三个问题: 1,我现在只是做了单个微服务代码的部署,怎么才能实现一次把整个微服都部署上容器中呢。 2. 部署上dokcer后,比如有10个微服务镜像,那我怎么才能让这些镜像不用自己去跑起来。 3.部署一次后,比如我代码更新了,jenkins的操作是怎么的(应该问怎么重新构建,我试过点击立即构建,但发现代码可以更新,但docker中会有两个名字一摸一样的镜像,这。。)docker里面的又是怎么操作,才能使部署的代码是最新的。


<div class="post-text" itemprop="text"> <p>I'm setting up Docker containers. </p> <p>On the server side, files are uploaded to S3. </p> <p>It succeeded to upload under my local environment. </p> <p>However, it fails to upload under Docker environment.</p> <ul> <li>client: React/axios</li> <li>server: Golang/gin</li> <li>db: mysql</li> <li>source code: <a href="" rel="nofollow noreferrer"></a></li> </ul> <pre><code>article  ├ client  ├ api  └ docker-compose.yml </code></pre> <p>Here is the docker-compose.yml:</p> <pre><code>version: '3' services: api: build: dockerfile: context: ./api volumes: - ./api:/app ports: - 2345:2345 depends_on: - db tty: true volumes: - $HOME/.aws/ </code></pre> <p>Here is the server side code to access to S3.</p> <pre><code>api := router.Group("/api") { api.POST("/post/image", func(c *gin.Context) { var creds *credentials.Credentials var err error creds = credentials.NewSharedCredentials("", "default") _, err = creds.Get() if err != nil { creds = credentials.NewCredentials(&amp;ec2rolecreds.EC2RoleProvider{}) _, err = creds.Get() } cfg := aws.NewConfig().WithRegion("ap-northeast-1").WithCredentials(creds) svc := s3.New(session.New(), cfg) form, _ := c.MultipartForm() files := form.File["images[]"] var imageNames []ImageName imageName := ImageName{} for _, file := range files { f, err := file.Open() if err != nil { log.Println(err) } defer f.Close() size := file.Size buffer := make([]byte, size) f.Read(buffer) fileBytes := bytes.NewReader(buffer) fileType := http.DetectContentType(buffer) path := "/media/" + file.Filename params := &amp;s3.PutObjectInput{ Bucket: aws.String("article-s3-jpskgc"), Key: aws.String(path), Body: fileBytes, ContentLength: aws.Int64(size), ContentType: aws.String(fileType), } resp, err := svc.PutObject(params) fmt.Printf("response %s", awsutil.StringValue(resp)) imageName.NAME = file.Filename imageNames = append(imageNames, imageName) } c.JSON(http.StatusOK, imageNames) }) } </code></pre> <p>I expect images are uploaded in server side to S3. </p> <p>But in actuality they're not. </p> <p>Here are some logs:</p> <pre><code>api_1 | 2019/07/31 14:58:53 [Recovery] 2019/07/31 - 14:58:53 panic recovered: api_1 | POST /api/post/image HTTP/1.1 api_1 | Host: localhost:2345 api_1 | Accept: application/json, text/plain, */* api_1 | Accept-Encoding: gzip, deflate, br api_1 | Accept-Language: en-US,en;q=0.9 api_1 | Connection: keep-alive api_1 | Content-Length: 92267 api_1 | Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryYx6aOI06AYceIHnU api_1 | Origin: http://localhost:3000 api_1 | Referer: http://localhost:3000/post/finish api_1 | User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 api_1 | api_1 | api_1 | runtime error: invalid memory address or nil pointer dereference api_1 | /usr/local/go/src/runtime/panic.go:82 (0x4427f0) api_1 | panicmem: panic(memoryError) api_1 | /usr/local/go/src/runtime/signal_unix.go:390 (0x44261f) api_1 | sigpanic: panicmem() api_1 | /go/src/ (0xa01a35) api_1 | (*EC2Metadata).GetMetadata: req := c.NewRequest(op, nil, output) api_1 | /go/src/ (0xa05607) api_1 | requestCredList: resp, err := client.GetMetadata(iamSecurityCredsPath) api_1 | /go/src/ (0xa05159) api_1 | (*EC2RoleProvider).Retrieve: credsList, err := requestCredList(m.Client) api_1 | /go/src/ (0x945246) api_1 | (*Credentials).Get: creds, err := c.provider.Retrieve() api_1 | /app/main.go:172 (0xb1dde1) api_1 | main.func5: _, err = creds.Get() api_1 | /go/src/ (0x8f97c9) api_1 | (*Context).Next: c.handlers[c.index](c) api_1 | /go/src/ (0x90d259) api_1 | RecoveryWithWriter.func1: c.Next() api_1 | /go/src/ (0x8f97c9) api_1 | (*Context).Next: c.handlers[c.index](c) api_1 | /go/src/ (0x90c300) api_1 | LoggerWithConfig.func1: c.Next() api_1 | /go/src/ (0x8f97c9) api_1 | (*Context).Next: c.handlers[c.index](c) api_1 | /go/src/ (0x9036c9) api_1 | (*Engine).handleHTTPRequest: c.Next() api_1 | /go/src/ (0x902dbd) api_1 | (*Engine).ServeHTTP: engine.handleHTTPRequest(c) api_1 | /usr/local/go/src/net/http/server.go:2774 (0x6dcc77) api_1 | serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) api_1 | /usr/local/go/src/net/http/server.go:1878 (0x6d8860) api_1 | (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) api_1 | /usr/local/go/src/runtime/asm_amd64.s:1337 (0x45a090) api_1 | goexit: BYTE $0x90 // NOP api_1 | api_1 | [GIN] 2019/07/31 - 14:58:53 | 500 | 695.0698ms | | POST /api/post/image </code></pre> </div>


<div class="post-text" itemprop="text"> <p>When running my Dockerfile I need to grab dependencies. This is done using <code>go get ./...</code>.</p> <p>However when doing <code>docker build -t test .</code> it hangs at the go get command. </p> <h3>here is the error message</h3> <blockquote> <p>exec go get -v -d </p> <p> (download) cd .; git clone <a href="" rel="nofollow"></a> /go/src/ Cloning into '/go/src/'... fatal: unable to access '<a href="" rel="nofollow"></a>': Could not resolve host: package exit status 128</p> </blockquote> <h3>here is the dockerfile</h3> <pre><code>FROM golang # Create a directory inside the container to store all our application and then make it the working directory. RUN mkdir -p /go/src/example-app WORKDIR /go/src/example-app # Copy the example-app directory (where the Dockerfile lives) into the container. COPY . /go/src/example-app # Download and install any required third party dependencies into the container. RUN go-wrapper download RUN go-wrapper install RUN go get ./... # Set the PORT environment variable inside the container ENV PORT 8080 # Expose port 8080 to the host so we can access our application EXPOSE 8080 # Now tell Docker what command to run when the container starts CMD ["go-wrapper", "run"] </code></pre> </div>

win7 docker 2375端口连接拒绝

springcloud 项目 在install 的时候会连接docker,但是会报以下错误: Caused by: Connect to localhost:2375 [localhost/, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect, dockerfile-maven-plugin版本是1.4.9。




提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...






反正,我的抖音没人看,别人都有几十万个赞什么的。 发到CSDN上来,大家交流下~ 主要用到原生态的 JS+CSS3。 具体不解释了,看注释: &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Title&lt;/tit...


我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...




自从有了微信和QQ,手机短信几乎很少再用了,但是我们手机里面还是经常会收到"回复TD退订"的消息,那到底要不要回复呢?今天就来告诉大家! 信息内容可能包括 推销信息 品牌活动日的时候,会根据你的用户浏览信息,或者购买记录,后续发送一些降价消息。 但是笔者想说我是缺那10块钱的人嘛,我缺的是1000块。 垃圾信息 虽然我们已经不经常用短信功能,但是还是有不少...


当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...


还记得当年面试一个面试官问我怎么加载巨图才能不撑爆内存,我没回答上来,他说分片显示,我寻思特么分片能减少内存使用??现在可以打他脸了! 内容扩展 1.图片的三级缓存中,图片加载到内存中,如果内存快爆了,会发生什么?怎么处理? 2.内存中如果加载一张 500*500 的 png 高清图片.应该是占用多少的内存? 3.Bitmap 如何处理大图,如一张 30M 的大图,如何预防 OOM? A...




北京时间2020年3月27日9点整,如往常一样来到公司,带开电脑,正准备打开Github网站看一会源代码,再开始手头的工作。哟吼,一直打不开,一直出现如下页面: 我想很多网友也尝到了甜头,各大技术群炸开了锅,据网友反馈有攻击者正在发起大规模的中间人挟持,京东和Github等网站等网站都受到了影响。 什么是中间中间人挟持呢? 简而言之,就是攻击者在数据网络传输的过程中,截获传输过程中的数据并篡改...


编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...


接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

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



写在开头: 上周面试了一位女程序员,上午10::30来我们部门面试,2B哥接待了她.来看看她的简历: 个人简历 个人技能: ● 熟悉spring mvc 、spring、mybatis 等框架 ● 熟悉 redis 、rocketmq、dubbo、zookeeper、netty 、nginx、tomcat、mysql。 ● 阅读过juc 中的线程池、锁的源...




已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...


近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...


分享的这9个保证另你意外的网站,每个都非常实用!非常干货!毫不客气的说,这些网站最少值10万块钱。 利用好这些网站,会让你各方面的技能都得到成长,不说让你走上人生巅峰,但对比现在的你,在眼界、学识、技能方面都有质的飞跃。 一、AIRPANO 传送门: 这是一个可以躺在家里,就能环游世界的神奇网站。 世界那么大,绝大多...


导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...


每家公司为了保证公司员工每天的工作时间,一般都会采用上下班打卡的工作制度,这其实是一个很常见的是,本身也没有什么问题的。正所谓无规矩不成方圆,公司肯定是有公司的规矩,虽然每个员工都很不喜欢这些规矩来束缚我们,但是公司也只是为了能更好的管理员工。但是一家公司如果一成不变的使用打卡制度,而不会去变通管理,也真不一定是好事。 打卡制度特别对于销售部门来说,不但会让公司发展不起来,还很容易丢失员工。但如...


这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...


A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...


文章目录前言正文**1、Kaspersky Cyberthreat real-time map****2、Finding Home****3、Silk – Interactive Generative Art****4、Liquid Particles 3D****5、WINDOWS93****6、Staggering Beauty****7、Ostagram图片生成器网址****8、全历史网址*...






在新冠疫情中,德国人越来越多地选择在超市,加油站或其他商店付款时使用非接触式付款方式。德国信贷协会Deutschen Kreditwirtschaft (DK) 的一位发言人告诉德国新...

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信