I am running one application which run python script and read the data and write to file. I am using docker to that.
Dockerfile:
FROM python:3
WORKDIR /usr/src/app
COPY . .
CMD ["test.py"]
ENTRYPOINT ["python3"]
Python code:
#!/usr/bin/env python3
import argparse
import sys
def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--input_file', required=True)
parser.add_argument('-o', '--output_file', required=True)
return parser
def main(argv):
parser = get_arguments()
args = parser.parse_args()
with open(args.output_file, 'w') as o:
o.write("hello world" + "\n")
if __name__ == "__main__":
main(sys.argv[1:])
I am generating image using this command:
docker build -t user/hello:1.0.0 .
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
user/hello 1.0.0 055851132d95 12 minutes ago 885MB
But i can't see anything when i run
%docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Looks like container to exited state.
I ran the container using following command.
docker run -it user/hello:1.0.0 test.py -t data/test_input.txt -o data/test_out.txt
But when i enter into the container checking the test_out.txt using
docker exec -it user/hello:1.0.0 /bin/sh
Error: No such container: user/hello:1.0.0
how can i check my test_out.txt?