修改正在运行的golang Docker容器,使用正在运行的shell。

huangapple go评论81阅读模式
英文:

Modifying golang Docker Container using the running shell

问题

我正在使用Docker将我的Web服务部署到Google Compute Engine,并且我正在按照这里给出的说明进行操作:https://blog.golang.org/docker

我想在golang容器中安装ffmpeg,我的方法是通过以下命令获取对shell的访问权限:

docker run -t -i my-webservice /bin/bash

与ubuntu:14.04镜像相反,我无法访问bash shell。这是为什么呢?

我还找到了一个已经配置和安装了ffmpeg的镜像(https://registry.hub.docker.com/u/cellofellow/ffmpeg/)。是否可以从golang容器中访问该容器,还是我必须将ffmpeg安装到自己的docker镜像中?

英文:

I'm using Docker to deploy my web service to Google Compute Engine and I'm following the instructions given here: https://blog.golang.org/docker

I want to install ffmpeg in the golang container and my approach is to get access to the shell as

docker run -t -i my-webservice /bin/bash

In contrary to the ubuntu:14.04 image, I don't get access to the bash shell. How can that be?

I have also found an image, where the ffmpeg is already configured and installed (https://registry.hub.docker.com/u/cellofellow/ffmpeg/). Is it possible to get access to the container from the golang container or do I have to install ffmpeg into my own docker image?

答案1

得分: 1

更好的方法是通过在Dockerfile中添加RUN命令来将ffmpeg安装到你的Golang容器中,例如:

RUN apt-get update
RUN apt-get install -y ffmpeg

修改Docker容器运行shell这些词有点违背了Docker的含义。

英文:

A better approach would be to install ffmpeg to your golang container by adding a RUN to your Dockerfile, like

RUN apt-get update
RUN apt-get install -y ffmpeg

The words modifying, Docker Container, running shell, kind of contradicts the meaning of Docker.

答案2

得分: 0

安装ffmepeg并不简单,如果还需要安装其他编解码器,那就更麻烦了。这也是我想在编写Docker脚本之前先在shell中尝试一下的原因(可以从cellofellow/ffmpeg复制Docker脚本)。

这里有一个解决问题的答案:https://github.com/docker-library/golang/issues/27

英文:

Installing ffmepeg is not as simple if additional codecs need to be installed as well, being the reason that I would like to play around using the shell before writing the docker script (copying the Docker script from cellofellow/ffmpeg works).

An answer to the problems are described here: https://github.com/docker-library/golang/issues/27

huangapple
  • 本文由 发表于 2014年11月19日 03:16:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/27002185.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定