Tomcat container only starts interactively - docker

I'm a bit new to Docker, but I recently build a container running an old version of Docker and an even older version of JSPWiki (2.2.33 - yes, THAT old). This is in order to decommission an old VM that this is running on.
When I run the following command, my container launches interactively and then I can manually launch my tomcat application and navigate to the Wiki:
docker run -it -v wikifiles:/apps/wikifiles -p 127.0.0.1:80:8080 wikitest:1.1 /bin/bash
When I just try to launch the container with the startup script, it fails...even though it's the same exact script.
docker run -it -v wikifiles:/apps/wikifiles -p 127.0.0.1:80:8080 wikitest:1.1 /usr/local/apache-tomcat-5.5.17/bin/startup.sh
If I include docker --log-level "debug" run ... to see what's going on, I get:
Using CATALINA_BASE: /usr/local/apache-tomcat-5.5.17
Using CATALINA_HOME: /usr/local/apache-tomcat-5.5.17
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-5.5.17/temp
Using JRE_HOME: /usr/lib/jvm/java-8-openjdk-amd64/jre/
EBU[0001] Error resize: Error response from daemon: bad file descriptor: unknown
DEBU[0001] [hijack] End of stdout
EBU[0001] Error resize: Error response from daemon: Container cbe278063c2389f2e3ad86ccb8944df5a600bb079d74e27e5a9cd1bb1e36ac2d is not running
I'm not even sure what to look at from here. Any help would be appreciated.
Thanks!

Related

Docker installation on Mac m1

I am trying to install Docker desktop on Mac m1 but after installation dockers asks to execute following command.
docker run -d -p 80:80 docker/getting-started
But, it gives following error
Unable to find image 'docker/getting-started:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": read tcp 192.168.65.4:58764->192.168.65.5:3128: read: connection reset by peer.
See 'docker run --help'.
Why is it not pulling docker data?
(Sorry for the miss... going to try this again)
Try docker exec command before your command.
Like this docker exec docker run -d -p 80:80 docker/getting-started
"Tried using the docker exec command and it appears to have worked OK with two different ubuntu instances. Did not try Docker Desktop.
It kind of looks like there is a problem with Docker Desktop manipulating Terminal.app.
I’m using the macOS default zshell."
https://forums.docker.com/t/problems-getting-started/116487/9

Input file not found in docker command on windows

Complete docker noob here, i installed docker desktop on windows - Trying to follow the commands on this link to setup OSRM backend on my machine. i've downloaded the dataset for india(india-latest.osm.pbf) to D:/docker
and am running the commands from that location
docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/india-latest.osm.pbf
fails with
[error] Input file /data/india-latest.osm.pbf not found!
i just don't understand WHY it doesn't work. according to osrm documentation of the docker command -
The file /data/india-latest.osm.pbf inside the container is referring
to "${PWD}/india-latest.osm.pbf" on the host.
but it's not the case,i am running from d:/docker so it should find india-latest.osm.pbf no problem. This is really really confusing to me even though it must be so basic
it was due to a bug in docker https://github.com/docker/for-win/issues/1712
when you change password it silently fails for commands that access the host filesystem on windows until you reauthenticate

Docker connection refused when started with -ti bash

I am new to docker and I tried to run the linuxconfig/lemp-php7 image. Everything worked fine and I could access the nginx web server installed on the container. To run this image I used this command:
sudo docker run linuxconfig/lemp-php7
When I tried to run the image with the following command to gain access over the container through bash I couldn't connect to nginx and I got the connection refused error message. Command: sudo docker run -ti linuxconfig/lemp-php7 bash
I tried this several times so I'm pretty sure it's not any kind of coincidence.
Why does this happen? Is this a problem specific to this particular image or is this a general problem. And how can I gain access to the shell of the container and access the web server at the same time?
I'd really like to understand this behavior to improve my general understanding of docker.
docker run runs the specified command instead of what that container would normally run. In your case, it appears to be supervisord, which presumably in turn runs the web server. So you're preventing any of that from happening.
My preferred method (except in cases where I'm trying to debug cases where the container won't even start properly) is to do the following after running the container normally:
docker exec -i -t $CONTAINER_ID /bin/bash

client (browser, jdbc driver) hangs when trying to connect with docker instance

Summary
Client (browser,jdbc drive) hangs connecting to docker.
Context
I've been playing with docker and found an oddity: stuff running on my host OS (browser, jdbc driver) "hangs" trying to connect to docker.
I've concluded the issue lies with 'docker' and 'my setup' versus the images themselves, due to the fact that the problem appears:
with both Tomcat official images as well as with Microsoft's new Sql Server image
after I've successfully run docker once
Usecase
Boot my laptop (ubuntu 14.04)
Start up docker (see Appendix )
Connect with browser http://localhost:8888/.
Result: Success
Shut down docker instance: 'ctrl-c'
Start up docker again (Repeat step 2)
Try to connect with browser
Result: Browser hangs/spins for 20 minutes, than says "aborted"
Notes
Docker starts without error in both steps
After shutdown (step 4), "netstat -aon |grep 8888" shows nothing. So no 'rogue process' is listening on port 888
Because browser "hangs", rather than says "connection refused", I concluded Docker listens on the port, but doesn't do anything else.
Version Info
Ubuntu 14.04
Docker version 1.9.1, build a34a1d5
Appendix A: Docker file and commands
Dockerfile
Dockerfile: FROM tomcat:8.5.8-jre8-alpine
Commands
Create Image:
$ docker build -t mytomcat_858 .
Start:
$ docker run -it --rm -p 8888:8080 mytomcat_858
What command are you executing to start Docker the second time? docker start mytomcat_858? If it starts correctly the second time, can you do docker attach mytomcat_858 and view possible Tomcat errors?
I found, if not the root cause, at least workaround: restarting the docker daemon cleared up all the networking issues:
# /etc/init.d/docker restart
Try running docker with the following:
docker run -d -p 8888:8080 mytomcat_858
Then,
You can do docker stop mytomcat_858, and docker start mytomcat_858 to stop and start the process. Do not repeat docker run command for the second time.

Get TeamCity running on Docker

I'm brand new to both TeamCity and Docker. I'm struggling to get a Docker container with TeamCity running and usable on my local machine. I've tried several things, to no avail:
I installed Docker for Mac per instructions here. I then tried to run the following command, documented here, for setting up teamcity in docker:
docker run -it --name teamcity-server-instance \
-v c:\docker\data:/data/teamcity_server/datadir \
-v c:\docker\logs:/opt/teamcity/logs \
-p 8111:8111 \
jetbrains/teamcity-server
That returned the following error: docker: Error response from daemon: Invalid bind mount spec "c:dockerdata:/data/teamcity_server/datadir": invalid mode: /data/teamcity_server/datadir.
Taking a different tack, I tried to follow the instructions here - I tried running the following command:
docker run -it --name teamcity -p 8111:8111 sjoerdmulder/teamcity
The terminal indicated that it was starting up a web server, but I can't browse to it at localhost, nor at localhost:8111 (error ERR_SOCKET_NOT_CONNECTED without the port, and ERR_CONNECTION_REFUSED with the port).
Since the website with the docker run command says to install Docker via Docker Toolbox, I then installed that at the location they pointed to (here). I then tried the
docker-machine ip default
command they suggested, but it didn't work, error "Host does not exist: "default"". That makes sense, since the website said the "default" vm would be created by running Docker Quickstart and I didn't do that, but they don't provide any link to Docker Quickstart, so I don't know what they are talking about.
To try to get the IP address the container was running on, I tried this command
docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
That listed the names of the running containers, each followed by a hyphen, then nothing. I also tried
docker ps -a
That listed running contaners also, but didn't give the IP. Also, the port is blank, and the status says "exited (130) 4 minutes ago", so it doesn't seem like the container stayed alive after starting.
I also tried again with port 80, hoping that would make the site show at localhost:
docker run -it --name teamcity2 -p 80:80 sjoerdmulder/teamcity
So at this point, I'm completely puzzled and blocked - I can't start the server at all following the instructions on hub.docker.com, and I can't figure out how to browse to the site that does start up with the other instructions.
I'll be very grateful for any assistance!
JetBrains now provides official docker images for TeamCity. I would recommend starting with those.
The example command in their TeamCity server image looks like this
docker run -it --name teamcity-server-instance \
-v <path to data directory>:/data/teamcity_server/datadir \
-v <path to logs directory>:/opt/teamcity/logs \
-p <port on host>:8111 \
jetbrains/teamcity-server
That looks a lot like your first attempt. However, c:\docker\data is a Windows file path. You said you're running this on a mac, so that's definitely not going to work.
Once TeamCity starts, it should be available on port 8111. That's what -p 8111:8111 part of the command does. It maps port 8111 on your machine to port 8111 in the VM Docker for Mac creates to run your containers. ERR_CONNECTION_REFUSED could be caused by several things. Two most likely possibilities are
TeamCity could take a little while to start up and maybe you didn't give it enough time. Solution is to wait.
-it would start the TeamCity container in interactive mode. If you exit out of the terminal window where you ran the command, the container will also probably terminate and will be inaccessible. Solution is to not close the window or run the container in detached mode.
There is a good overview of the differences between Docker for Mac and Docker Toolbox here: Docker for Mac vs. Docker Toolbox. You don't need both, and for most cases you'll want to use Docker for Mac for testing stuff out locally.

Resources