The commands are like:
docker run / stop / rm ...
which works in terminal while causes segmentation fault in bash script.
I compared the environments between bash script and terminal, as shown below.
2c2
< BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
---
> BASHOPTS=cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:login_shell:progcomp:promptvars:sourcepath
7,8c7,8
< BASH_LINENO=([0]="0")
< BASH_SOURCE=([0]="./devRun.sh")
---
> BASH_LINENO=()
> BASH_SOURCE=()
10a11
> COLUMNS=180
14a16,18
> HISTFILE=/home/me/.bash_history
> HISTFILESIZE=500
> HISTSIZE=500
19a24
> LINES=49
22a28
> MAILCHECK=60
28c34,37
< PPID=12558
---
> PIPESTATUS=([0]="0")
> PPID=12553
> PS1='[\u@\h \W]\$ '
> PS2='> '
32,33c41,42
< SHELLOPTS=braceexpand:hashall:interactive-comments
< SHLVL=2
---
> SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
> SHLVL=1
42,52c51
< _=./devRun.sh
< dao ()
< {
< echo "Dao";
< docker run -dti -v /tmp/projStatic:/var/projStatic -v ${PWD}:/home --restart always -p 50000:50000 --name projDev daocloud.io/silencej/python3-uwsgi-alpine-docker sh;
< echo "Dao ends."
< }
< docker ()
< {
< docker run -dti -v ${PWD}:/home --restart always -p 50000:50000 --name projDev owen263/python3-uwsgi-alpine-docker sh
< }
---
> _=/tmp/env.log
UPDATE:
The info and version:
docker version Client: Version: 1.13.1 API version: 1.26 Go version: go1.7.5 Git commit: 092cba3727 Built: Sun Feb 12 02:40:56 2017 OS/Arch: linux/amd64 Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Go version: go1.7.5 Git commit: 092cba3727 Built: Sun Feb 12 02:40:56 2017 OS/Arch: linux/amd64 Experimental: false
docker info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 1 Server Version: 1.13.1 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: aa8187dbd3b7ad67d
docker versionanddocker info