![]() Almost always, you will be working with docker containers. ![]() I can think of only a few reasons why you would want to SSH into a docker-machine, but it is possible with the command above. To SSH into a running docker-machine image, you can use docker-machine ssh DOCKER_IMAGE_NAME To SSH into a running container, you can use docker exec -it CONTAINER_NAME bash You can SSH into both the docker-machine image as well as the containers. The reason I address this is because from your question, I'm not entirely sure what terminology you are trying to use. Container usually refers to the top-most layer of an image (and is the "write" layer). So the word "image" and the word "container" could get inter-mingled in a few contexts. An image is just a set of layers of containers that have been saved together. A container is based off of the virtual machine (docker-machine), but is completely isolated from other containers (it has it's own file system, process trees, etc). VirtualBox documentation for port forwarding:Ī docker-machine is like a virtual machine. Assuming you are using VirtualBox (the default driver for Mac OS X installs), you can configure port forwarding in the VirtualBox UI or via VBoxManage (documentation link below).ĭocker documentation for exposing ports: Doing so would require some networking config in your docker-machine driver. If desired, you can also configure access to the services via localhost, rather than using the docker-machine IP. You'll have to refer to your container's documentation to see what services are being exposed. Of course, this requires your container to expose a service on port 22. ![]() Now you can gain access by using the docker-machine's IP, like this (assuming default docker-machine): ssh -p 2022 ip default) ![]() This will bind port 2022 on the docker-machine to port 22 inside the container. For example, you might map the SSH port like this: docker run -d -p 2022:22 my-image This is typically done by exposing ports to the docker-machine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |