Closed cordoval closed 10 years ago
:baby: /cc @deeky666 @asm89 could you (begging) please take a look? thanks!
@cordoval What exactly means "crash"? Can you provide any error output of the container startup?
after i run the container it dies, and then i docker logs it and:
/usr/bin/python2: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
Looks like the package zlib1g-dev
is not installed. Trying installing that.
how, is that sudo apt-get zlib1g-dev ?
i mean does that not come in with the utils?
RUN apt-get install -y zlib1g-dev
I am not sure what those lines have to do with it really. TBH I don't have enough context on this issue. Just tried to build your Dockerfile manually on my machine and it does not work because I don't have the build
directory. Not sure how to reproduce. However, if I uncomment those instructions that are related to the build
directory, I can at least start a container successfully. What is the docker command you use to startup a container?
@deeky666 use the folders here http://github.com/fideloper/docker-nginx-php it is the box i use but modify the dockerfile according to what i pasted above on the description
I clone the git repo above into a folder with the name below and run from one level up:
docker build --rm -t docker-nginx-php ./docker-nginx-php
Then inherit in an empty Dockerfile FROM this build and build that image too and then run it with:
docker run -p 80:80 -v $(pwd)/api:/var/www --name c-api -d api /sbin/my_init --enable-insecure-key
@cordoval using the repo you provided, modifying the Dockerfile
to match yours, I don't get any errors when starting the container. Even with those 4 lines uncommented. Try rebuilding the image without cache docker build -t my-image --no-cache .
and then start the container with docker run -it my-image
(for testing purposes). Works perfectly for me.
deeky@localhost:~/docker-nginx-php$ docker run -it my-image
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 8
docker ps -a does not show it crashes? i will try the --no-cache option
No the container is running until I stop it. And as you see I don't get your phyton error.
are you using the vagrant box from the korean yangsung? for boot2docker?
No I use it natively on ubuntu. Are you using docker through boot2docker? Maybe that causes some issues?
yes i am on a mac using vagrant from youngsang boot2docker, but i don't think that is the problem right?
I don't know to be honest. My collegue is on mac, too and was working with boot2docker but also encountered weird issues. Especially shared host mounts seem to be a problem. However I am really not sure what is causing your problem. Did rebuilding the image do any difference?
no i now get a different problem when i move the expose lines at the very end after the apt-get
2014/04/24 10:32:44 exec: "/sbin/my_init": stat /sbin/my_init: no such file or directory
before building it without that change still gives the same error
Please paste the command you use to start the container.
docker run -p 80:80 -v $(pwd)/api:/var/www --name c-api -d api /sbin/my_init --enable-insecure-key
Are you sure api
is the image you built before? Because in your Gist you built an image called docker-nginx-php
. Otherwise I don't have a reasonable explanation for this.
This is my startup (replaced -d
with -it
for debugging): https://gist.github.com/deeky666/0de216ed8bd7609191a8
i build an image off of that, so
docker build --no-cache --rm -t api ./api
and the docker file inside that folder is:
# api server already running nginx
FROM docker-nginx-php
MAINTAINER Luis Cordova version: 1.0
EXPOSE 80
EXPOSE 81
hmm weird, reproduced with your second Dockerfile and still get no errors :(
I can't believe it, i am rebuilding my vagrant box now. And retrying. What is your other friend using then in his mac now?
He switched to use docker natively in an ubuntu virtual machine directly without boot2docker. So no docker client -> vagrant -> docker daemon setup anymore.
so here is the real question @deeky666 , it seems to work for you when you fire the run with -d and the argument is the direct build docker-nginx-php, however if you extend that into a folder api with a dockerfile with FROM docker-nginx-php and everything else empty and run the container with -d pointing to the new api image, it fails. So the notion of extending dockerfiles is what I am lacking and is not clear how to extend the dockerfiles in a way that keep them running.
Can you please explain how to extend dockerfiles?
What you have to do is the following:
docker-nginx-php
image from the root folder (as base for your api image)api
image with the previously built image docker-nginx-php
as base using the FROM
instructionapi
image container with the docker run
commandExtending images is exactly that. You use the FROM
instruction in your Dockerfile to tell docker to build additional instructions on top of that base image.
cd /path/to/docker-nginx-php
docker build -t docker-nginx-php .
cd api
docker build -t api .
docker run -p 80:80 -v $(pwd):/var/www --name c-api -d api /sbin/my_init --enable-insecure-key
Something like that.
this is exactly what we are doing
now i tried and get
docker@boot2docker:/vagrant$ docker run -it -p 80:80 -v $(pwd)/api:/var/www --name c-api docker-nginx-php bash
bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
is messed up
WTH! There is something seriously broken in your image if you can't even get bash
to run oO. Maybe your Dockerfile is messed up. I would advise you to build the image step by step from "scratch". Each time running a container and see what happens. Then add another instruction and run again until you get an error.
@deeky666 can you push your dockerfile into a repo? so i can clone and verify?
I went to my old ubuntu machine and i get the same problem
It's basically what you pasted for me. Here are the two Dockerfiles:
your gist is wrong is not from phusion only and it is not using an extra docker file anymore
will the fact that the exposes come after the last line or before the apt-get clean matter?
yeah sorry. replace phusion
with docker-nginx-php
. I was just naming it like that on my machine.
No it does not matter where you put the EXPOSE
instructions
i have no idea stumped
Hmmm is the original docker-nginx-php
image running for you fine? Without modifications?
so i removed the api dockerfile and just running it from docker-nginx-php on the run, the build for docker-nginx-php works however I added a line like i show in my gist, it is not the clone straight. It has only those modifications on the dockerfile. The run is what crashes.
Try building and running the original Dockefile, if that runs fine please outline the modified lines again. Then we'll see.
solved it by removing the exposes
The dockerfile below crashes after I uncomment these 4 lines shown below in the docker file:
here:
why when running such a container would crash? can someone please explain?