Is there any way to create a isolated environment in Ubuntu 14.04? I have a unstable application installed and sometimes it doesn't work, I don't know why. So, I'm trying to make a isolate environment, in a way that the dependencies I install will be available only in this environment (something like python virtual environment).
The program needs these dependencies to be installed: libc6, libstdc++6, imagemagick, perl, libgl1-mesa-glx, and libglu1-mesa
I hope you have understood my question. Thank you!
You can use Docker to create an isolated environment similar to a VM. You would have the have the Docker daemon running on your development machine (available on Mac, Windows, and Linux). You then create a Dockerfile
that starts with the Ubuntu 14.04 base image. You can then use the Docker syntax to write commands to install your dependencies, and copy your code into the Docker container (instance of your isolated environment).
So let's say you have a basic java app and you are in the /app
directory:
/app
|
├── /bin
| └── app.jar
|
├── /src
| └── app.java
|
└── Dockerfile
Your Dockerfile
would look as follows to describe your isolated environment:
# Use the Ubuntu 14.04 base image
FROM ubuntu:14.04
# Install dependencies
# (assuming they are available via apt-get)
# <install Java here>
RUN apt-get install -y \
libc6 \
libstdc++6 \
imagemagick \
perl \
libgl1-mesa-glx \
libglu1-mesa
# Copy code (or binaries) into the container
COPY app/bin/app.jar /app.jar
# Expose port 8080
EXPOSE 8080
# Run the application
CMD java -jar app.jar
You then need to build
an image from the Dockerfile
with the build command:
docker build -t app .
Then run it (let's say it exposes port 8080):
docker run -p 8080:8080 app
Now your app will be available at localhost:8080
on your development machine, but it will be running in an isolated Ubuntu container.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With