ONE simulator can be used to Simulate Delay Tolerant Networks . First clone the repository in the preferred directory using
git clone https://github.com/akeranen/the-one.git
Enter the-one directory using
cd the-one
Now we will write a Dockerfile in this directory to build an image
To build the image run the following command :
docker build -t theoneimage1 .
here we have specified the name of our image as theoneimage1. Now we will proceed to run our container based on this image .
docker run --name theoneconatainer -it theoneimage1
We will get the following output:
Till here we have successfully run the simulator inside the docker container , but how should we copy the reports that were generated by the simulator inside the container to our local machine ?
For that we will use the cp command provided by docker.
docker cp theoneconatainer:/app src/reports
Now since the app folder (which we had created in our container using WORKDIR command in Dockerfile) has been copied to our reports folder in the project . Where we could easily find our reports for analysis.
Basic docker commands and their meaning
WORKDIR - Set the working directory in the container
CMD - Define the command to run the application
Example - CMD ["npm", "start"]
COPY - Copy the rest of the application code to the container
Example - COPY . .
RUN - Install dependencies or compile the code
Example - RUN npm install
For logging into Docker Hub:
docker login
docker push <your_docker_hub_username>/<your_docker_hub_repo>
To check the status of docker containers use:
sudo docker ps
To stop a docker container
sudo docker stop <your_container_name>
docker tag command:
docker tag myapp:latest myrepository/myapp:v1.0
myapp:latest
is the source image with the tag "latest."myrepository/myapp:v1.0
is the target image with the tag "v1.0."
After running this command, the Docker image myrepository/myapp:v1.0
will be a new tag for the same image as myapp:latest
. This is useful for versioning your images, providing meaningful names, or preparing images for deployment to a registry. After which we could use the following command:
docker push myrepository/myapp:v1.0