Trying to run a docker container from docker-py, but when I run:
client.containers.run(image='my/image:tag')
I get this error:
TypeError: sequence item 0: expected a bytes-like object, str found
Encoding to bytes with:
client.containers.run(image='my/image:tag'.encode())
Gives the error:
TypeError: b'my/image:tag' is not JSON serializable
I've tried going through the run function to see if there's a tag keyword, but as far as I can tell there's not.
Try running images.list()
first and then use get
to get the required image
Ex:
client.images.list()
#--> Should output all available Images
Then Run
container = client.images.get('Image_Name')
container.stop() #Stops Image.
This should give you exact image name.
container.attrs['Config']['Image']