I'm having a problem using Docker/Fig to set up StrongLoop.
'slc run' works locally but it runs into an error when I run 'fig up'
I have a very basic fig file:
web:
build: .
command: slc run
volumes:
- .:/srv/data
ports:
- "3000:3000"
links:
- mysql
mysql:
image: mysql:latest
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD:xxx
Edit: This is my Dockerfile
# Pull nodejs base image
FROM google/nodejs:0.10.30
RUN apt-get -y update
# Install stongloops
RUN npm install --global pg strongloop
#Get source code
RUN cd / && git clone https://github.com/dmathewwws/ios-api.git
# Install dependencies
RUN cd /ios-api && npm install
# Expose running port
EXPOSE 3000
WORKDIR /ios-api
This is the error returned:
Creating iosapi_mysql_1...
Traceback (most recent call last):
File "/usr/local/bin/fig", line 9, in <module>
load_entry_point('fig==1.0.1', 'console_scripts', 'fig')()
File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 31, in main
command.sys_dispatch()
File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch
self.dispatch(sys.argv[1:], None)
File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 28, in dispatch
super(Command, self).dispatch(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch
self.perform_command(*self.parse(argv, global_options))
File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 56, in perform_command
handler(project, command_options)
File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 427, in up
insecure_registry=insecure_registry,
File "/Library/Python/2.7/site-packages/fig/project.py", line 174, in up
for (_, container) in service.recreate_containers(insecure_registry=insecure_registry):
File "/Library/Python/2.7/site-packages/fig/service.py", line 199, in recreate_containers
container = self.create_container(insecure_registry=insecure_registry, **override_options)
File "/Library/Python/2.7/site-packages/fig/service.py", line 176, in create_container
container_options = self._get_container_create_options(override_options, one_off=one_off)
File "/Library/Python/2.7/site-packages/fig/service.py", line 371, in _get_container_create_options
container_options['environment'] = dict(resolve_env(k, v) for k, v in container_options['environment'].iteritems())
AttributeError: 'str' object has no attribute 'iteritems'
If you have copy/pasted your fig.yml
accurately, it has an error in it.
To use the dictionary format for the environment variables, you need a space between MYSQL_ROOT_PASSWORD:
and xxx
.
mysql:
image: mysql:latest
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: xxx
Alternatively you can use the array form, which is a list of strings of the form VAR=val
:
mysql:
image: mysql:latest
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=xxx