Code Monkey home page Code Monkey logo

Comments (13)

typicode avatar typicode commented on May 9, 2024 1

Hi @lowski,

There's progress, you can now map a local domain to a URL:

hotel add http://192.168.100.99:80 -n my-docker
# http://my-docker.dev -> http://192.168.100.99:80

But you would still need to start manually your docker container (or add it to hotel and start it manually from the UI after that).

Isn't it possible to bind the container to localhost?

from hotel.

typicode avatar typicode commented on May 9, 2024 1

I tried this:

  1. Installed Docker on Mac https://www.docker.com/products/docker#/mac
  2. created a Dockerfile
FROM ubuntu

RUN apt-get update
RUN apt-get -y install python
RUN apt-get clean

EXPOSE 8000

CMD [ "python", "-m", "SimpleHTTPServer" ]

By default SimpleHTTPServer listens to 8000, so I've not set it again in the command.

Finally, I've run the following commands:

$ docker build -t python-test .
$ hotel add 'docker run -p $PORT:8000 python-test'

and it works. Let me know if I'm missing something.

from hotel.

typicode avatar typicode commented on May 9, 2024

I'm not so familiar with docker containers so let met know if it's missing something.

But if you start them using a command and they have a fixed port, you can add them this way for example:

hotel add -n docker -p service_port 'docker_command'

http://docker.dev will start container using docker_command and proxy request to http://127.0.0.1:service_port

from hotel.

brad-decker avatar brad-decker commented on May 9, 2024

Docker containers start with a command line option but to access them locally they are attached to a specific ip address and port. In my case 192.168.100.99:80 .. i'm struggling trying to figure out the add syntax that will work with this but i desperately want it to work lol.

from hotel.

typicode avatar typicode commented on May 9, 2024

@brad-decker thank you for the feedback.

Right now, hotel only supports servers binding to localhost. But supporting other cases, like yours, is on the roadmap :) (i.e. being able to have domain.dev proxy requests to x.x.x.x:PORT)

Maybe if you can make your docker containers start on $PORT and bind to localhost, but I guess if you're asking for such a feature it's because you can't change the IP/port.

from hotel.

lcmen avatar lcmen commented on May 9, 2024

Any progress on that?:)

from hotel.

lcmen avatar lcmen commented on May 9, 2024

@typicode thanks for the info. That's a good start.

The problem with Docker on OS X is related to inability to run docker natively; you need VM (virtualbox, vmware, xhyve, etc.) with Linux where Docker daemon can be run.

from hotel.

typicode avatar typicode commented on May 9, 2024

Added an issue for this. I'm thinking about this:

hotel add 'docker-cmd' --port 80 --host 192.168.100.99

@lowski Do you think it would enough?

from hotel.

lcmen avatar lcmen commented on May 9, 2024

@typicode I think it should work. If you have the code somewhere (temp branch or something) I can try it out (most probably during the weekend).

from hotel.

typicode avatar typicode commented on May 9, 2024

Great thanks for the feedback and offering help, I appreciate :)
Not yet, but I think I have a pretty good idea how to do it so maybe not this weekend but soon

from hotel.

typicode avatar typicode commented on May 9, 2024

@lowski do you have a simple docker command that I can use to test?

from hotel.

lcmen avatar lcmen commented on May 9, 2024

@typicode if you have python docker image you can use: python -m SimpleHTTPServer 8000. Remember to expose the port (8000).

from hotel.

jrolfs avatar jrolfs commented on May 9, 2024

@typicode solid example (assuming Docker for Mac). I just came across this thread but I think it may help to the shed some light on @brad-decker's original question and said example.

I believe @brad-decker is referencing a "non-native" Docker setup (basically anything besides Linux) where Docker is running in a Linux VM instead of directly on the host machine. Before Docker for Mac/Windows was released this was the only way to run Docker in that environment. Now (I can only speak directly on Docker for Mac) the networking is handled transparently and any ports that are exposed on a container, eg: -p $PORT:8000 are automagically forwarded and accessible on the host machine. This is why the example you posted simply works.

I believe you can probably refer to said example going forward in reference to Docker support for Hotel. There are some networking intricacies with Docker that will always exist and probably differ slightly based on platform but I believe the intentions of the Docker team are to make that part of the networking layer as seamless as possible going forward. It may also be worth deciding whether you want to claim support for anything besides the now "official" solutions for running Docker on all supported platforms to simplify any Docker specific Hotel documentation.

from hotel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.