Bad variable name on Docker images

1 post / 0 new
#1 Fri, 2017-05-12 01:12
  • omata's picture
  • Offline
  • Last seen: 9 months 2 weeks ago
  • Joined: 2017-05-12


Some days ago I started to have some issues with all my alpine based images. I'm using runit to package some apps using nginx and python. So, recently after re-install my system with Ubuntu 16.04, (my previous version was 14.04), and install the latest docker version I was seeing a weird behaviour with my alpine based images. When I link it with any mysql databse and I get all those environmet variables injected into my alpine container I geth the following error:

Starting pre-service scritps in /etc/my_init.d
*** Running: /etc/my_init.d/
/sbin/my_init: export: line 148: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX: bad variable name


Docker info

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 45
Server Version: 17.05.0-ce
Storage Driver: aufs
 Root Dir: /home/user/docker-data/aufs
 Backing Filesystem: extfs
 Dirs: 56
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
  Profile: default
Kernel Version: 4.4.0-77-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 5.72GiB
Name: workstation
ID: ...
Docker Root Dir: /home/user/docker-data
Debug Mode (client): false
Debug Mode (server): false
Registry: <a href="
Experimental:" rel="nofollow">
Experimental:</a> false
Insecure Registries:
Live Restore Enabled: false
WARNING: No swap limit support

The issue is present even if I use alpine docker image version 3.4 or 3.5. It makes no difference.

BTW Some weeks ago the same image did work flawlessly, I'm guessing that the issue is related with docker version, but I don't know how to fix it.

Best regards,

UPDATE-1: I tracked down the issue to a script exporting all environment variables, it is weird because If I run the script, the export fails saying: bad variable name but if I issue exactly the same command from the command line interface it doesn't complain. You can see the script at: