Docker Compose File (TensorFlow)

TensorFlow has supported Docker containers that could save the time from installing lots of stuffs on our operating system and messing around.

Besides typing in long Docker Command each time in the terminal for launching the container, using Docker Compose file is another option.

Create a new file called TensorFlow.yml and paste everything below into that file.

Freely to change the path in volumes in accordance with our computer’s path.

 

version: '3.1'

services:

	TernsorFlow:
		container_name: TensorFlow
		image: tensorflow/tensorflow:latest-py3
		restart: unless-stopped
		network_mode: "bridge"
		ports:
			- 6006:6006
		tty: true
		command: /bin/bash
		volumes:
			- /Users/AndyWu/Documents/Docker/TensorFlow:/TensorFlow

 
To create and start a new TensorFlow container from docker compose file, run the command.

docker-compose -f TensorFlow.yml up -d

Now our newly created container should start running.

Execute the bash shell in the container and interact with the pseudo-TTY by providing the options-it.

docker exec -it TensorFlow bash

We are now able to run our TensorFlow files with python in the container.


Leave a Reply