Mount container folder to host

Asked

Viewed 158 times

0

Good afternoon, folks, I’d like some guidance on creating an image and Compose. I am preparing an environment for the java development team with eclipse toncat java and initial Workspace.

I thought from an image of Ubuntu. I would like to leave already by default a structure inside /usr/local/java in the image until then ok, but I have Workspace that I can not leave in the image because it would not allow to write in it. What would be the right practice to adopt for this Workspace? I can make a Compose file to do the first checkout on the host machine?

I currently have the image with all the Workspace inside and I’m trying to see the files of the contaminar on the host but I can’t... just the opposite.

commands I’ve used:

docker run -d -it  --name eclipseDocker2  --mount type=bind,source="/Users/michel.teixeira/eclipseDocker/",target=/usr/local/java/ eclipse_beta4
  • It wouldn’t be better from a JDK, Maven or Tomcat image?

  • the entire already compiled environment and Tomcat has a specific frozen version. And Eclipse uses another more current version of the host machine in this case

1 answer

0

I guess I didn’t quite understand.

Do you need to make your container checkout a host directory that your container is running on? This can be done when your container starts (set in a ENTRYPOINT). As you have already set a volume, everything that the container save in this volume you will be able to access through the host. For example, imagine that I started my container as follows: Docker run -v /home/user/Workspace:/app/Workspace Ubuntu:Latest

When your container initializes and the checkout command you set in your Dockerfile’s ENTRYPOINT write to the directory /app/workspace from the container, any other process running on the host will be able to access these files by going to the directory /home/user/workspace host.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.