Im just experimenting with coreOS, docker and fleet. I have the next dockerfile:
FROM ubuntu:14.04
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y install nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN mkdir /etc/nginx/ssl
ADD default /etc/nginx/sites-available/default
EXPOSE 80
CMD ["nginx"]
I created an image ("nginx-example") from this file and i can launch the container with:
docker run -v /home/core/share:/var/www:rw -p 80:80 -d nginx-example
Now, I want to launch it with fleet, so I undertand that I have to create a service file and then launching it with fleet.
So I try to create de service file (nginx1.service):
[Unit]
Description=MyTry
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill nginx
ExecStartPre=-/usr/bin/docker rm nginx
ExecStartPre=/usr/bin/docker pull nginx-example
ExecStart=/usr/bin/docker docker run -p 80:80 -d nginx-example
ExecStop=/usr/bin/docker stop nginx
I submmited and started it but when I do:
fleetctl list-units
nginx1.service cbbed2c1.../IP failed failed
And I cant run the web server. I think that the problem is in the service file but I dont know how to construct it. Thank you.