![]() If it is not running, check the logs for the reason. If you app does not response, check if the container is running by typing docker ps or the remote API. When you start your container, you need to bind this port to a port of the host: docker run -p 80:8080 my/application In your Dockerfile you need to EXPOSE the port your app runs on: FROM ubuntu To access the application in the container, you need to open the port in the container and bind to a port on the host. You can also specify a certain host name for the container (by passing the -hostname="test42" to the run command). You can check this IP address via the remote API or via Docker on the host machine directly. docker run -p 80:8080 -v /home/ubuntu/docker-logs:/var/log:rw my/applicationĮvery container will get its own IP address. Then all your logs will end up in /home/ubuntu/docker-logs on your host. all logs to /var/log and mount this folder to my host machine. What I prefer is to write the logs to a certain directory, e.g. You can run also run docker logs to receive the Docker logs. You can run docker attach to attach to a certain container an see its stdout. It also shows you the ports your app is exposing. If you do not see your app, it is not running. To see all running containers run docker ps on your host. Note that the API is open to the world now! In a real scenario you would need to secure it in some way (e.g. To use the Docker remote API from another machine, I needed to open it explicitly: docker -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock -d & The API is a REST-API with several binding for programming languages (at ). ![]() You can use it to see all running containers (which would be your use case, right?), inspect a certain container or start and stop containers. Remote APIĪs JimiDini said, one possibility is the Docker remote API. There are some possibilities to check whether your app is running. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |