小编Ali*_*nce的帖子

docker exec命令的结果

我需要在我的shell脚本中知道一些docker exec命令的输出,例如我有一个nginx容器,在我的脚本中运行:

docker exec -it containerName /etc/init.d/nginx configtest

我想仅在nginx配置测试成功时才继续执行脚本,而不是在失败时.

我已经尝试使用$?,但它0甚至然后configtest输出失败(因为我理解的docker exec成功执行).

bash shell docker

12
推荐指数
3
解决办法
1万
查看次数

.bash_profile不适用于docker php映像

有我的Dockerfile

# https://hub.docker.com/_/php/
FROM php:5.5.23-fpm

USER www-data

ADD .bash_profile /var/www/.bash_profile

SHELL ["/bin/bash", "-c"]

RUN source /var/www/.bash_profile
Run Code Online (Sandbox Code Playgroud)

然后,在构建容器后,我运行了docker exec -it CONTAINER_NAME bash,但没有看到定义为的别名/var/www/.bash_profile。但是,如果我source /var/www/.bash_profile手动执行–一切正常。

这里描述了相同的问题:https//github.com/docker/kitematic/issues/896,但没有答案。

docker dockerfile

2
推荐指数
2
解决办法
2357
查看次数

标签 统计

docker ×2

bash ×1

dockerfile ×1

shell ×1