Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty IP address #1

Closed
chbrandt opened this issue Jul 24, 2014 · 22 comments
Closed

Empty IP address #1

chbrandt opened this issue Jul 24, 2014 · 22 comments

Comments

@chbrandt
Copy link

Hi, when I follow the commands to start the MySQL container/daemon:
docker run -name mysql -d sameersbn/mysql:latest
and try to get the IP address
MYSQL_IP=$(docker inspect mysql | grep IPAddres | awk -F'"' '{print $4}')
But I am receiving an empty (MYSQL_IP) address.

What am I missing?
Thanks.

Below is the full "inspect" output from mysql container:
[{
"ID": "58e2feb006a8115659e5963a18e36f380daa2ebef5f859998e9fd164d6ee6060",
"Created": "2014-07-24T11:42:06.149458819Z",
"Path": "/start",
"Args": [],
"Config": {
"Hostname": "58e2feb006a8",
"Domainname": "",
"User": "",
"Memory": 0,
"MemorySwap": 0,
"CpuShares": 0,
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"PortSpecs": null,
"ExposedPorts": {
"3306/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"HOME=/",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DEBIAN_FRONTEND=noninteractive"
],
"Cmd": [
"/start"
],
"Dns": [
"8.8.8.8",
"8.8.4.4"
],
"Image": "sameersbn/mysql:latest",
"Volumes": {
"/var/lib/mysql": {}
},
"VolumesFrom": "",
"WorkingDir": "",
"Entrypoint": null,
"NetworkDisabled": false,
"OnBuild": null
},
"State": {
"Running": false,
"Pid": 0,
"ExitCode": 1,
"StartedAt": "2014-07-24T11:42:06.256444663Z",
"FinishedAt": "2014-07-24T11:42:06.443349565Z",
"Ghost": false
},
"Image": "931eb2b8bba4856ee2ded254661a40b5c56b3d505c49b19670b748418dd1c827",
"NetworkSettings": {
"IPAddress": "",
"IPPrefixLen": 0,
"Gateway": "",
"Bridge": "",
"PortMapping": null,
"Ports": null
},
"ResolvConfPath": "/var/lib/docker/containers/58e2feb006a8115659e5963a18e36f380daa2ebef5f859998e9fd164d6ee6060/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/58e2feb006a8115659e5963a18e36f380daa2ebef5f859998e9fd164d6ee6060/hostname",
"HostsPath": "/var/lib/docker/containers/58e2feb006a8115659e5963a18e36f380daa2ebef5f859998e9fd164d6ee6060/hosts",
"Name": "/trusting_mclean",
"Driver": "aufs",
"ExecDriver": "native-0.1",
"Volumes": {
"/var/lib/mysql": "/var/lib/docker/vfs/dir/21b0edbba3d0a376db035c91b4484560db388c61cf8f9f56dd75191242214a9d"
},
"VolumesRW": {
"/var/lib/mysql": true
},
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LxcConf": [],
"Privileged": false,
"PortBindings": {
"3306/tcp": null
},
"Links": null,
"PublishAllPorts": false
}
}]

@sameersbn
Copy link
Owner

@chbrandt well it appears the mysql container error out and is not running.

"State": {
"Running": false,
"Pid": 0,
"ExitCode": 1,
"StartedAt": "2014-07-24T11:42:06.256444663Z",
"FinishedAt": "2014-07-24T11:42:06.443349565Z",
"Ghost": false
},

I suggest you run the image using the command docker run -name mysql -it --rm sameersbn/mysql:latest and paste in the output here.

@chbrandt
Copy link
Author

@sameersbn it outputs just the following lines:

chbrandt@workland:~$ docker run --name mysql -it --rm sameersbn/mysql:latest
WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and containers can't use it. Using default external servers : [8.8.8.8 8.8.4.4]
Installing database...

Thanks.

@sameersbn
Copy link
Owner

@chbrandt does the container exit after that?

@chbrandt
Copy link
Author

@sameersbn Yes. (Sorry not to have said that.) It just exit and (--rm) removes the container.

@sameersbn
Copy link
Owner

@chbrandt Can you provide me your host (distro / version) and the docker info using the command docker version && docker info?

@chbrandt
Copy link
Author

@sameersbn Of course!...

The "docker version" output:

chbrandt@workland:$ docker version
Client version: 0.9.1
Go version (client): go1.2.1
Git commit (client): 3600720
Server version: 0.9.1
Git commit (server): 3600720
Go version (server): go1.2.1
Last stable version: 1.1.2, please update docker
chbrandt@workland:
$

The "docker info" output:

chbrandt@workland:$ docker info
Containers: 2
Images: 118
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Dirs: 122
Execution Driver: native-0.1
Kernel Version: 3.13.0-32-generic
Username: chbrandt
Registry: [https://index.docker.io/v1/]
WARNING: No swap limit support
chbrandt@workland:
$

And my Distro/Kernel/Package are:

chbrandt@workland:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

chbrandt@workland:~$ uname -a
Linux workland 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

chbrandt@workland:$ dpkg --status docker.io
Package: docker.io
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 21726
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Architecture: amd64
Version: 0.9.1
dfsg1-2
Depends: adduser, iptables, init-system-helpers (>= 1.13~), sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16), perl, libapparmor1 (>= 2.6devel), libc6 (>= 2.4), libdevmapper1.02.1 (>= 2:1.02.63), libsqlite3-0 (>= 3.5.9)
Recommends: aufs-tools, ca-certificates, cgroupfs-mount | cgroup-lite, git, xz-utils
Suggests: btrfs-tools, debootstrap, lxc, rinse
Conffiles:
/etc/bash_completion.d/docker.io d4aed0a07bf3d6f2a509cc395c7cf604
/etc/init/docker.io.conf e80e99076eae246ff87c1a357f631333
/etc/default/docker.io 935f2cec7e40d685db072d2d7c95a051
/etc/init.d/docker.io 6b0abc39ab8ab937ef03429f71511160
Description: Linux container runtime
Docker complements kernel namespacing with a high-level API which operates at
the process level. It runs unix processes with strong guarantees of isolation
and repeatability across servers.
.
Docker is a great building block for automating distributed systems:
large-scale web deployments, database clusters, continuous deployment systems,
private PaaS, service-oriented architectures, etc.
.
This package contains the daemon and client. Using docker.io on non-amd64
hosts is not supported at this time. Please be careful when using it on
anything besides amd64.
.
Also, note that kernel version 3.8 or above is required for proper operation of
the daemon process, and that any lower versions may have subtle and/or glaring
issues.
Original-Maintainer: Paul Tagliamonte paultag@debian.org
Built-Using: golang-context-dev (= 0.0
git20130701-1), golang-go.net-dev (= 0.0hg20131201-1), golang-gocapability-dev (= 0.0git20130208-1), golang-gosqlite-dev (= 0.0hg20130601-1), golang-mux-dev (= 0.0git20130701-1), golang-pty-dev (= 0.0~git20130701-1)
Homepage: https://github.com/dotcloud/docker

Thanks.

@sameersbn
Copy link
Owner

@chbrandt I think this should solve the issue.
You need to update docker to a newer docker from docker.io. Current docker version is 1.1.2

You can execute the following procedure to install an up to date version of docker

sudo apt-get remove lxc-docker* docker.io
curl -s https://get.docker.io/ubuntu/ | sudo sh
sudo apt-get update
sudo apt-get install lxc-docker

I am pretty sure updating docker should resolve the problem.

@chbrandt
Copy link
Author

Good morning @sameersbn , It didn't work. Same thing: prints out "Installing database..." only and exits.

@mattiash
Copy link

mattiash commented Aug 1, 2014

I have the exact same problem:

root@for:# docker run --name mysql -it --rm sameersbn/mysql:latest
Installing database...
root@for:
#

This is on Ubuntu 14.04.1, both with docker 0.9.1 (from Ubuntu repositories) and 1.1.2 (from get.docker.io)

@sameersbn
Copy link
Owner

@mattiash can you try performing a system update sudo apt-get dist-upgrade, reboot and retry. I use ubuntu 14.04 (updated) and have had no problems. I want to test again but cannot right now.

@sameersbn
Copy link
Owner

@mattiash reportedly there are some issue with docker and kernel version 3.15. If the problem persists after an update please try downgrading to kernel version 3.11. Take a look at moby/moby/issues/5704 for some insight.

@mattiash
Copy link

mattiash commented Aug 1, 2014

I did a dist-upgrade and reboot, but the problem persists. I'm on kernel 3.13

root@for:~# uname -a
Linux for 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

The server is running other things as well. so it is difficult to downgrade the kernel.

@mattiash
Copy link

mattiash commented Aug 1, 2014

I tried running all commands in /start manually inside the docker container. All is well until mysql_install_db, but that command fails:

root@f77b92109cda:/# mysql_install_db --user=mysql
Installing MySQL system tables...
140801 11:20:03 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140801 11:20:03 [Warning] Using unique option prefix bind instead of bind-address is deprecated and will be removed in a future release. Please use the full name instead.
ERROR: 1  Can't create/write to file '/var/lib/mysql/mysql/db.MYI' (Errcode: 13)
140801 11:20:03 [ERROR] Aborting

140801 11:20:03 [Note] /usr/sbin/mysqld: Shutdown complete


Installation of system tables failed!  Examine the logs in
/var/lib/mysql for more information.

You can try to start the mysqld daemon with:

    shell> /usr/sbin/mysqld --skip-grant &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /var/lib/mysql that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before submitting a bug report
at http://bugs.mysql.com/

I then tried to change to the user mysql to see if I could create the file manually, but it failed:

root@f77b92109cda:/# su mysql -c /bin/bash 
su: User not known to the underlying authentication module

However, the user mysql exists:

root@f77b92109cda:/# grep mysql /etc/passwd
mysql:x:101:103:MySQL Server,,,:/nonexistent:/bin/false

@sameersbn
Copy link
Owner

@chbrandt @mattiash I just got the chance to test your run command docker run --name mysql -it --rm sameersbn/mysql:latest and it worked for me flawlessly.

I have docker version 1.1.2 and ubuntu 14.04 (updated) and have the same kernel version as you, i.e. 3.13.0-32.

With that out of the way, I suspect there you could have suffered image corruption. Can you try removing the sameersbn/mysql image and retrying

docker rmi sameersbn/ubuntu:12.04.20140628
docker rmi sameersbn/mysql:latest
docker pull sameersbn/mysql:latest
docker run --name mysql -it --rm sameersbn/mysql:latest

I think your issue should get resolved.

@sameersbn
Copy link
Owner

@mattiash I double checked by pulling the image from the docker index and it worked without any problems. Please let me know if this resolves your issue.

@mattiash
Copy link

mattiash commented Aug 1, 2014

No change:

root@for:~# docker rmi sameersbn/mysql:latest
Error response from daemon: No such image: sameersbn/mysql:latest
2014/08/01 15:18:53 Error: failed to remove one or more images
root@for:~# docker rmi sameersbn/ubuntu:12.04.20140628
Error response from daemon: No such image: sameersbn/ubuntu:12.04.20140628
2014/08/01 15:19:35 Error: failed to remove one or more images
root@for:~# docker pull sameersbn/mysql:latest
Pulling repository sameersbn/mysql
931eb2b8bba4: Download complete 
511136ea3c5a: Download complete 
65b7e9ccb809: Download complete 
f8dd6bd14f58: Download complete 
a343823119db: Download complete 
ea7d6801c538: Download complete 
6eb9bf01977b: Download complete 
24750c3b8e04: Download complete 
bea002a43c2a: Download complete 
8e67ffd1d76d: Download complete 
3f1191360aed: Download complete 
fe53b4a9503a: Download complete 
c16af3504844: Download complete 
c05ff689c7b1: Download complete 
bfcbd8e87059: Download complete 
f4d4ccedf6ef: Download complete 
741004e79f46: Download complete 
91980dcd503c: Download complete 
root@for:~# docker run --name mysql -it --rm sameersbn/mysql:latest
Installing database...
root@for:~# 

Do you have a mysql user in your host OS? I don't.

@sameersbn
Copy link
Owner

@mattiash

$ docker rmi sameersbn/mysql:latest
Error response from daemon: No such image: sameersbn/mysql:latest

^^^How come?

If this did not solve the issue then maybe the image corruption took place in the ubuntu base image. You may need to remove the image as well. Can you remove all existing docker images and container and retry:

WARNING
The below commands will stop all running containers, delete all stopped containers and delete all images.

You clean up all docker images by running the following commands

docker stop $(docker ps -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker images

Run the above commands repeatedly until docker images does not list any image.

Now pull the image again and retry:

docker pull sameersbn/mysql:latest
docker run --name mysql -it --rm sameersbn/mysql:latest

Do you by any chance have selinux installed and enabled on your ubuntu host? If yes, then it could be the cause of concern.

@mattiash
Copy link

mattiash commented Aug 1, 2014

I find it hard to believe that the corruption happened on my machine. It has ECC memory and raid-1 disks. However, I did as you suggested:

root@for:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
root@for:~# docker pull sameersbn/mysql:latest
Pulling repository sameersbn/mysql
931eb2b8bba4: Download complete 
511136ea3c5a: Download complete 
65b7e9ccb809: Download complete 
f8dd6bd14f58: Download complete 
a343823119db: Download complete 
ea7d6801c538: Download complete 
6eb9bf01977b: Download complete 
24750c3b8e04: Download complete 
bea002a43c2a: Download complete 
8e67ffd1d76d: Download complete 
3f1191360aed: Download complete 
fe53b4a9503a: Download complete 
c16af3504844: Download complete 
c05ff689c7b1: Download complete 
bfcbd8e87059: Download complete 
f4d4ccedf6ef: Download complete 
741004e79f46: Download complete 
91980dcd503c: Download complete 
root@for:~# docker run --name mysql -it --rm sameersbn/mysql:latest
Installing database...
Starting MySQL server...
140801 14:02:39 InnoDB: Completed initialization of buffer pool
140801 14:02:39 InnoDB: highest supported file format is Barracuda.
140801 14:02:39  InnoDB: Waiting for the background threads to start
140801 14:02:40 InnoDB: 5.5.37 started; log sequence number 1595675
140801 14:02:40 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140801 14:02:40 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
140801 14:02:40 [Note] Server socket created on IP: '0.0.0.0'.
140801 14:02:40 [Note] Event Scheduler: Loaded 0 events
140801 14:02:40 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.37-0ubuntu0.12.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

and it worked! Thank you for your help. Now I'll continue with your gitlab instructions.

@sameersbn
Copy link
Owner

@mattiash Every once in a while this issue occurs. I believe the issue occurs during the docker pull. It's sort of a crappy problem that requires deletion of all docker images since it is not possible to determine the filesystem layer at which the corruption has occured.

@sameersbn
Copy link
Owner

@chbrandt you may need to perform the steps outline in my comment above to resolve the issue.

@chbrandt
Copy link
Author

chbrandt commented Aug 1, 2014

@sammersbn I did it. And, guess what?... It worked!
Now I'll also go through gitlab and redmine :)
Thanks!

@sameersbn
Copy link
Owner

@chbrandt @mattiash perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants